</http:response>
</rest:response>
</pre>
|}
==web:response-header==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|web:response-header|$path as xs:string|element(rest:response)}}<br/>
|-
| '''Summary'''
|Creates a [[RESTXQ#Response|RESTXQ reponse header]] for the specified <code>$file</code> with the correct mime-type and some caching directives. The output will only be correctly evaluated if no other items are returned before the header.
|-
| '''Examples'''
|If the following RESTXQ function is called…<br/>
<pre class="brush:xquery">
declare %rest:path('image/{$image}') function local:get($image) {
let $path := 'path/to/' || $image
return (
web:response-header($path),
file:read-binary($path)
)
};
</pre>
…an image with the specified name (if available) will be sent back to the client:<br/>
<pre class="brush:xml">
<rest:response xmlns:rest="http://exquery.org/ns/restxq">
<http:response xmlns:http="http://expath.org/ns/http-client" status="302">
<http:header name="Cache-Control" value="max-age=3600,public"/>
</http:response>
<output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
<output:media-type value="image/png"/>
<output:method value="raw"/>
</output:serialization-parameters>
</rest:response>,
...
</pre>
|}