braid-http 0.3.18 → 0.3.20
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 +16 -4
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -230,7 +230,7 @@ async function braid_fetch (url, params = {}) {
|
|
|
230
230
|
// Now we define the subscription function we just used:
|
|
231
231
|
function start_subscription (cb, error) {
|
|
232
232
|
if (!res.ok)
|
|
233
|
-
throw new Error('Request returned not ok', res)
|
|
233
|
+
throw new Error('Request returned not ok status:', res.status)
|
|
234
234
|
|
|
235
235
|
if (res.bodyUsed)
|
|
236
236
|
// TODO: check if this needs a return
|
package/braid-http-server.js
CHANGED
|
@@ -236,10 +236,22 @@ function braidify (req, res, next) {
|
|
|
236
236
|
res.statusCode = 209
|
|
237
237
|
res.setHeader("subscribe", req.headers.subscribe)
|
|
238
238
|
res.setHeader('cache-control', 'no-cache, no-transform')
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
// Note: I used to explicitly disable transfer-encoding chunked
|
|
242
|
+
// here by setting the header to empty string. This is the only
|
|
243
|
+
// way I know to disable it in nodejs. We don't need chunked
|
|
244
|
+
// encoding in subscriptions, because chunked encoding is used to
|
|
245
|
+
// signal the end of a response, and subscriptions don't end. I
|
|
246
|
+
// disabled them to make responses cleaner. However, it turns out
|
|
247
|
+
// the Caddy proxy throws an error if it receives a response with
|
|
248
|
+
// transfer-encoding: set to the empty string. So I'm disabling
|
|
249
|
+
// it now.
|
|
250
|
+
|
|
251
|
+
// if (req.httpVersionMajor == 1) {
|
|
252
|
+
// // Explicitly disable transfer-encoding chunked for http 1
|
|
253
|
+
// res.setHeader('transfer-encoding', '')
|
|
254
|
+
// }
|
|
243
255
|
|
|
244
256
|
// Tell nginx not to buffer the subscription
|
|
245
257
|
res.setHeader('X-Accel-Buffering', 'no')
|