Skip to content

Commit

Permalink
replace res.set()
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed Feb 11, 2025
1 parent 5dc908c commit 0ce11b1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/handlers/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -118,23 +118,25 @@ async function handler (req, res, next) {
let headers = {
'Content-Type': contentType
}
let statusCode = 200
if (contentRange) {
headers = {
...headers,
'Content-Range': contentRange,
'Accept-Ranges': 'bytes',
'Content-Length': chunksize
}
res.statusCode = 206
statusCode = 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(statusCode, headers)
return stream.pipe(res)
}

Expand Down

0 comments on commit 0ce11b1

Please sign in to comment.