braid-http 1.3.33 → 1.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/braid-http-server.js +4 -12
- package/package.json +1 -1
package/braid-http-server.js
CHANGED
|
@@ -313,20 +313,12 @@ function braidify (req, res, next) {
|
|
|
313
313
|
// parse the multiplexer id and stream id from the url
|
|
314
314
|
var [multiplexer, stream] = req.headers.multiplexer.slice(1).split('/')
|
|
315
315
|
|
|
316
|
-
var end_things = (msg) => {
|
|
317
|
-
// 422 = Unprocessable Entity (but good syntax!)
|
|
318
|
-
res.writeHead(422, {Multiplexer: req.headers.multiplexer})
|
|
319
|
-
res.end(msg)
|
|
320
|
-
}
|
|
321
|
-
|
|
322
316
|
// find the multiplexer object (contains a response object)
|
|
323
317
|
var m = braidify.multiplexers?.get(multiplexer)
|
|
324
|
-
if (!m)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
m.streams.delete(stream)
|
|
329
|
-
return end_things(`multiplexer stream ${req.headers.multiplexer} already aborted`)
|
|
318
|
+
if (!m) {
|
|
319
|
+
// 422 = Unprocessable Entity (but good syntax!)
|
|
320
|
+
res.writeHead(422, {Multiplexer: `/${multiplexer}`})
|
|
321
|
+
res.end(`multiplexer ${multiplexer} does not exist`)
|
|
330
322
|
}
|
|
331
323
|
|
|
332
324
|
// let the requester know we've multiplexed their response
|