Commit c5148d46 authored by Jérôme Chauveau's avatar Jérôme Chauveau
Browse files

Merge branch 'md/plugin-files-headers' into 'dev'

Set content-type and expires headers on plugin files

See merge request pdn-certic/MaX!35
parents a8e8eac2 51576d75
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))
};

(: