Commit 51576d75 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

Set content-type and expires headers on plugin files

parent a8e8eac2
Loading
Loading
Loading
Loading
+10 −3
Changes for rxq/file.xqm: 10 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -33,10 +33,17 @@ function max.file:UIFile(
:)
declare
%rest:path("/plugins/{$filePath=.*}")
function max.file:pluginUIFile(
        $filePath as xs:string){
function max.file:pluginUIFile($filePath as xs:string){
    let $path := file:parent(file:parent(static-base-uri())) || "/plugins/" || $filePath
  return max.util:rawFile($path)
    let $mediaType := web:content-type($path)
    return
        (<rest:response>
            <http:response status="200">
                <http:header name="content-type" value="{$mediaType}"/>
                <http:header name="expires" value="Tue, 22 Oct 2222 22:22:22 GMT"/>
            </http:response>
        </rest:response>,
        file:read-binary($path))
};

(: