diff --git a/lib/handlers/get.js b/lib/handlers/get.js index 3bc7fbfb..a108bcc6 100644 --- a/lib/handlers/get.js +++ b/lib/handlers/get.js @@ -101,7 +101,7 @@ async function handler (req, res, next) { RDFs.includes(contentType) && !isHtmlResource && !ldp.suppressDataBrowser) if (useDataBrowser) { - res.set('Content-Type', 'text/html') + res.setHeader('Content-Type', 'text/html') const defaultDataBrowser = require.resolve('mashlib/dist/databrowser.html') const dataBrowserPath = ldp.dataBrowserPath === 'default' ? defaultDataBrowser : ldp.dataBrowserPath debug(' sending data browser file: ' + dataBrowserPath) @@ -118,6 +118,7 @@ async function handler (req, res, next) { let headers = { 'Content-Type': contentType } + if (contentRange) { headers = { ...headers, @@ -125,16 +126,17 @@ async function handler (req, res, next) { 'Accept-Ranges': 'bytes', 'Content-Length': chunksize } - res.statusCode = 206 + res.status(206) } - if (prep & isRdf(contentType) && !res.sendEvents({ + if (prep && isRdf(contentType) && !res.sendEvents({ config: { prep: prepConfig }, body: stream, isBodyStream: true, headers })) return - res.set(headers) + + res.writeHead(res.statusCode, headers) // res.set sneds 'charset' return stream.pipe(res) }