Hi Marco,
The current RESTXQ 1.0 specification seems to mandate that comma separated lists needs to be extracted to single items [1]. There isn’t that much activity on the EXQuery repository [2], but maybe it could be discussed over there?
As an alternative, you can use the request:header function to retrieve the full value [3].
Best, Christian
[1] http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-spe... [2] https://github.com/exquery/exquery/issues [3] http://docs.basex.org/wiki/Request_Module#request:header
On Tue, May 29, 2018 at 1:49 PM, Marco Lettere m.lettere@gmail.com wrote:
Hello all,
need to use the If-Modified-Since header in one of my APIs. The format requested is the IETF date format:
If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT
as explained in [1].
If I pass the header as prescribed to a restxq made like:
declare %rest:path("config") %rest:header-param("If-Modified-Since", "{$modifiedsince-ietf}") %rest:HEAD function config:check($modifiedsince-ietf as xs:string?){
I get the following exception:
Cannot convert xs:string+ to xs:string?: ("Wed", "21 Oct 2015 07:28:00 GMT").
Which somehow demonstrates that , is treated as a separator of values for the header.
I patched by replacing ? with * and using a string-join on the $modifiedsince-ietf before passing it to the follwoing parse-ietf-date function. But this is hard to explain and probably subject to other issues in the future.
Is there a way to pass HTTP headers verbatim to the RestXQ function?
thanks!
M.
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If -Modified-Since