-
Notifications
You must be signed in to change notification settings - Fork 66
xdmp:set-response-code does not seem to work with ML 8.0-3 #511
Comments
Are you saying that the output-status part does work but xdmp:set-response-code() does not? |
(edit: sorta). You see 'DELETE called', with 200/OK rather than the 501/Not Implemented. The snippet from below was from the ML REST docs, for how they seem to be setting the response code/message. declare Will output 502/All Busted. |
Okay. Looks like our extension template needs an update. |
Response codes should be set in $context, not with xdmp:set-response-code(). http://docs.marklogic.com/guide/rest-dev/extensions#id_31884
That is enough to close the issue with ML8.0-3. Probably want to have something more with fn:error() later on rather than xdmp:set-response-code... but... xdmp:set-response-code will indeed set the code/message. |
Response codes should be set in $context, not with xdmp:set-response-code(). http://docs.marklogic.com/guide/rest-dev/extensions#id_31884
Seems like xdmp:set-response-code does not do anything anymore. Exceptions (real ones) seem to get forwarded, but if I try to manually set a response code, it still comes back as 200/OK.
declare
%roxy:params("")
function cs:delete(
$context as map:map,
$params as map:map
) as document-node()?
{
map:put($context, "output-types", "application/xml"),
xdmp:set-response-code(501, "Not Implemented"),
document { "DELETE called" }
};
I see the docs for the ML REST client show something like this now.
http://docs.marklogic.com/guide/rest-dev/extensions#id_31884
declare function example:put(
$context as map:map,
$params as map:map,
$input as document-node()*
) as document-node()?
{
...
map:put($context, "output-status", (201, "Created"));
};
The text was updated successfully, but these errors were encountered: