braid-http 1.3.42 → 1.3.43
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 +10 -0
- package/package.json +1 -1
package/braid-http-server.js
CHANGED
|
@@ -340,6 +340,16 @@ function braidify (req, res, next) {
|
|
|
340
340
|
return res.end(`multiplexer ${multiplexer} does not exist`)
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
// if this request-id already exists, respond with an error
|
|
344
|
+
if (m.requests.has(request)) {
|
|
345
|
+
res.writeHead(409, 'Conflict', {'Content-Type': 'application/json'})
|
|
346
|
+
return res.end(JSON.stringify({
|
|
347
|
+
error: 'Request already exists',
|
|
348
|
+
message: `Cannot create duplicate request with ID '${request}'`,
|
|
349
|
+
details: 'This request ID must be unique'
|
|
350
|
+
}))
|
|
351
|
+
}
|
|
352
|
+
|
|
343
353
|
m.res.write(`start request ${request}\r\n`)
|
|
344
354
|
|
|
345
355
|
// let the requester know we've multiplexed their response
|