braid-http 1.3.37 → 1.3.39

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.
@@ -947,7 +947,7 @@ async function multiplex_fetch(url, params, skip_multiplex_method) {
947
947
  try {
948
948
  var res = await normal_fetch(url, params)
949
949
 
950
- if (res.status === 422 && !(await promise_done(mux_promise))) {
950
+ if (res.status === 424 && !(await promise_done(mux_promise))) {
951
951
  // this error will trigger a retry if the user is using that option
952
952
  throw new Error('multiplexer not yet connected')
953
953
  }
@@ -290,14 +290,14 @@ function braidify (req, res, next) {
290
290
  // if the multiplexer doesn't exist, send an error
291
291
  var m = braidify.multiplexers?.get(multiplexer)
292
292
  if (!m) {
293
- res.writeHead(422, 'Multiplexer no exist', {'Bad-Multiplexer': multiplexer})
293
+ res.writeHead(404, 'Multiplexer no exist', {'Bad-Multiplexer': multiplexer})
294
294
  return res.end(`multiplexer ${multiplexer} does not exist`)
295
295
  }
296
296
 
297
297
  // if the stream doesn't exist, send an error
298
298
  let s = m.streams.get(stream)
299
299
  if (!s) {
300
- res.writeHead(422, 'Stream no exist', {'Bad-Stream': stream})
300
+ res.writeHead(404, 'Stream no exist', {'Bad-Stream': stream})
301
301
  return res.end(`stream ${stream} does not exist`)
302
302
  }
303
303
 
@@ -324,7 +324,7 @@ function braidify (req, res, next) {
324
324
  // find the multiplexer object (contains a response object)
325
325
  var m = braidify.multiplexers?.get(multiplexer)
326
326
  if (!m) {
327
- res.writeHead(422, 'Multiplexer no exist', {'Bad-Multiplexer': multiplexer})
327
+ res.writeHead(424, 'Multiplexer no exist', {'Bad-Multiplexer': multiplexer})
328
328
  return res.end(`multiplexer ${multiplexer} does not exist`)
329
329
  }
330
330
 
@@ -343,7 +343,7 @@ function braidify (req, res, next) {
343
343
  ].map(x => x.toLowerCase()))
344
344
 
345
345
  // copy any CORS headers from the user
346
- var cors_headers = Object.entries(res.getHeaders()).
346
+ var cors_headers = Object.entries(res2.getHeaders()).
347
347
  filter(x => braidify.cors_headers.has(x.key))
348
348
 
349
349
  if (og_stream) {
@@ -428,6 +428,10 @@ function braidify (req, res, next) {
428
428
  // just touching these seems to cause issues
429
429
  key === '_events' || key === 'emit'
430
430
 
431
+ // empirically, on an http1 server,
432
+ // this causes res2 to close prematurely
433
+ || key === 'destroyed'
434
+
431
435
  // adding these lines gets rid of some deprecation warnings.. keep?
432
436
  || key === '_headers'
433
437
  || key === '_headerNames') continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-http",
3
- "version": "1.3.37",
3
+ "version": "1.3.39",
4
4
  "description": "An implementation of Braid-HTTP for Node.js and Browsers",
5
5
  "scripts": {
6
6
  "test": "node test/server.js"