Created
December 22, 2016 23:01
-
-
Save tternquist/685e58a0df46ffe525be5c320654fbcd to your computer and use it in GitHub Desktop.
Gzip encoding for MarkLogic REST extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $result := element result {"Hi"} | |
return | |
if(fn:contains(xdmp:get-request-header("Accept-encoding"),"gzip")) | |
then | |
( | |
document { | |
xdmp:gzip( | |
text { $result } ) | |
}, | |
xdmp:add-response-header("Content-encoding", "gzip") | |
) | |
else document {$result} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment