Changes

Jump to navigation Jump to search
6 bytes removed ,  12:46, 12 May 2020
===Content Negotiation===
Functions can be restricted to specific Media Types:. The default type is {{Code|*/*}}. Multiple types can either be specified by a single or by multiple annotations.
====Consuming Data====
<syntaxhighlight lang="xquery">
declare
%rest:POST("{$body}")
%rest:path("/xml")
%rest:consumes("application/xml")
%rest:consumes("text/xml")
function page:xml($body) { <xml/> $body };
</syntaxhighlight>
function page:xml() { <xml/> };
</syntaxhighlight>
 
Multiple types can either be specified by a single or by multiple annotations. If no annotations are specified, {{Code|*/*}} is the default type.
Note that the annotations will ''not'' affect the type of the actual response: You will need to supply an additional <code>[[#Output|%output:media-type]]</code> annotation or (if a single function may produce results of different types) generate an apt [[#Custom_Response|Custom Response]].
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu