</syntaxhighlight>
* The following expression returns a media-type for binary data, a caching directive, and the OK status:<br/>
<syntaxhighlight pre lang="'xquery"'>
web:response-header(
map { 'media-type': 'application/octet-stream' },
</syntaxhighlight>
* The following RESTXQ function returns the contents of a file to the client with correct media type:<br/>
<syntaxhighlight pre lang="'xquery"'>
declare %rest:path('media/{$file}') function local:get($file) {
let $path := 'path/to/' || $file