Skip to content

Commit

Permalink
test: destroy both proxied request and response on close
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Mar 15, 2020
1 parent bc92424 commit 61e1b19
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/eventsource_test.js
Expand Up @@ -93,16 +93,17 @@ function createProxy (target, protocol, callback) {
upstreamRes.pipe(res)
})

proxied.push(upstreamReq)
proxied.push({req: upstreamReq, res: res})
upstreamReq.end()
})

servers.push(server)

var oldClose = server.close
server.close = function (closeCb) {
proxied.forEach(function (res) {
res.abort()
proxied.forEach(function (pair) {
pair.req.abort()
pair.res.destroy()
})

oldClose.call(server, function () {
Expand Down

0 comments on commit 61e1b19

Please sign in to comment.