Hi all,
I want to share my experience with HTTP module while posting to restxq.
Consider this example,
-------- import module namespace http='http://expath.org/ns/http-client'; let $req := <http:request method="GET" href="http://localhost:8984/restxq/example" status-only = "false" username = "admin" password = "admin" send-authorization="true"> </http:request>
let $resp := http:send-request($req) return $resp ----------
run the same query with status-only="false" and status-only="true".
the first one(status-only="false") gives exception while the second one(status-only="true") returns proper response header. This is making difficult to handle the response of some requests which MAY contain body data. suppose we want to return the content of the document, if exists, as response body or a standard 410 status. The request should obviously contain status-only = "false".
we also tried handling response with the one below, but the issue does exists. rest:response <http:response status="410" reason="Gone"> </http:response> </rest:response>
I have tried with other http client like Firefox Poster plug-in and it is returning expected response. Is there anything wrong in the approach?
Thanks, Seenivasan