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.
- package/braid-http-client.js +1 -1
- package/braid-http-server.js +8 -4
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -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 ===
|
|
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
|
}
|
package/braid-http-server.js
CHANGED
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|