Skip to content

Commit

Permalink
Merge pull request #1808 from nodeSolidServer/fix/issue#1807
Browse files Browse the repository at this point in the history
replace res.set()
  • Loading branch information
bourgeoa authored Feb 12, 2025
2 parents 5dc908c + 887a94e commit 67fc385
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
}

if (contentRange) {
headers = {
...headers,
'Content-Range': contentRange,
'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)
}

Expand Down

0 comments on commit 67fc385

Please sign in to comment.