Hello,
I've a question to the response-header() function of the web module.
In my RESTXQ function I try to return a response with HTTP Status 404:
module namespace basex ='basex';
declare %rest:GET %rest:path("/db/{$db}/doc/{$doc}") %rest:produces("application/xml") %output:method("xml") function basex:doc($dbas xs:string, $docas xs:string)as item()* { web:response-header(map {},map {},map {"status" :404}),<notfound/> };
When I call this function I get the error:
[basex:restxq] Unexpected node: status="404".
If I call the function outside of the RESTXQ context the following response is generated:
<rest:response xmlns:rest="http://exquery.org/ns/restxq" *status="404"*> <http:response xmlns:http="http://expath.org/ns/http-client%22/%3E <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization%22/%3E </rest:response> <notfound/>
Shouldn't the status attribute be put on the http:response element instead?
Best regards Johannes
Dear Johannes,
Thanks for the observation. The third argument was added to the function just recently, and it was done wrong. I have just fixed this, a new stable snapshot is available [1]. The next patch release (BaseX 9.1.2) will be released in the near future.
Best, Christian
[1] http://files.basex.org/releases/latest/
On Thu, Jan 10, 2019 at 7:42 AM Johannes Bauer johannes.bauer@tanner.de wrote:
Hello,
I've a question to the response-header() function of the web module.
In my RESTXQ function I try to return a response with HTTP Status 404:
module namespace basex = 'basex';
declare %rest:GET %rest:path("/db/{$db}/doc/{$doc}") %rest:produces("application/xml") %output:method("xml") function basex:doc($db as xs:string, $doc as xs:string) as item()* { web:response-header(map {}, map {}, map {"status" : 404}), <notfound/> };
When I call this function I get the error:
[basex:restxq] Unexpected node: status="404".
If I call the function outside of the RESTXQ context the following response is generated:
<rest:response xmlns:rest="http://exquery.org/ns/restxq" status="404"> <http:response xmlns:http="http://expath.org/ns/http-client%22/%3E <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization%22/%3E </rest:response>
<notfound/>
Shouldn't the status attribute be put on the http:response element instead?
Best regards Johannes
basex-talk@mailman.uni-konstanz.de