Skip to content

Commit 887a94e

Browse files
authored
Clean up status code
Clean up status code for 206 case.
1 parent edd5a52 commit 887a94e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/handlers/get.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -118,27 +118,25 @@ async function handler (req, res, next) {
118118
let headers = {
119119
'Content-Type': contentType
120120
}
121-
let statusCode = 200
121+
122122
if (contentRange) {
123123
headers = {
124124
...headers,
125125
'Content-Range': contentRange,
126126
'Accept-Ranges': 'bytes',
127127
'Content-Length': chunksize
128128
}
129-
statusCode = 206
129+
res.status(206)
130130
}
131131

132-
// prep use res status
133-
res.statusCode = statusCode
134132
if (prep && isRdf(contentType) && !res.sendEvents({
135133
config: { prep: prepConfig },
136134
body: stream,
137135
isBodyStream: true,
138136
headers
139137
})) return
140138

141-
res.writeHead(statusCode, headers) // res.set sneds 'charset'
139+
res.writeHead(res.statusCode, headers) // res.set sneds 'charset'
142140
return stream.pipe(res)
143141
}
144142

0 commit comments

Comments
 (0)