Hello,
I'm trying to do a custom multipart response with basex RESTXQ module.
The Custom Response paragraph of https://docs.basex.org/wiki/RESTXQ
indicates :
Custom responses can be generated in XQuery by returning an
|rest:response| element, an |http:response| child node that matches the
syntax of the EXPath HTTP Client Module
<http://expath.org/spec/http-client> specification, and optional child
nodes that will be serialized as usual.
So, the §4.1 of http://expath.org/spec/http-client (EXPath HTTP Client
Module <http://expath.org/spec/http-client>) indicates :
<http:response status = integer
message = string>
(http:header*,
(http:multipart |
http:body)?)
</http:response>
But when I try :
declare %rest:path('media4') function page:testjm4() {
<rest:response>
<http:response status="200" message="OK">
<http:header name="Content-Length" value="100"/>
<http:body media-type="text">
TEST
</http:body>
</http:response>
</rest:response>};
The answer is irremediably :
Stopped at /root/basex/webapp/test.xqm, 46/39:
[basex:restxq] Unexpected node: <http:body xmlns:http="http://expath.org/ns/http-client" media-type="text">
TEST 
</http:body>
Neither hhtp:body or http:multipart element can be placed as a child of
http:response, that seems contradictory with the expath.org spec...
Any help would be appreciated...
Thanks o lot!
JM
Using :
BaseX Version 10.7
httpserver : basexhttp
Operating System: Ubuntu 18.04.6 LTS
Kernel: Linux 4.15.0-197-generic
Architecture: x86-64