Skip to content

Commit

Permalink
Clean up status code
Browse files Browse the repository at this point in the history
Clean up status code for 206 case.
  • Loading branch information
CxRes authored Feb 12, 2025
1 parent edd5a52 commit 887a94e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/handlers/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +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
}
statusCode = 206
res.status(206)
}

// prep use res status
res.statusCode = statusCode
if (prep && isRdf(contentType) && !res.sendEvents({
config: { prep: prepConfig },
body: stream,
isBodyStream: true,
headers
})) return

res.writeHead(statusCode, headers) // res.set sneds 'charset'
res.writeHead(res.statusCode, headers) // res.set sneds 'charset'
return stream.pipe(res)
}

Expand Down

0 comments on commit 887a94e

Please sign in to comment.