Skip to content

Commit

Permalink
test(rest): fix connection reset errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos authored and raymondfeng committed Nov 1, 2018
1 parent f787be9 commit ef1facd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/rest/test/integration/http-handler.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,17 @@ describe('HttpHandler', () => {
});

/**
* Ignore the EPIPE error
* Ignore the EPIPE and ECONNRESET errors.
* See https://github.com/nodejs/node/issues/12339
* @param err
*/
function ignorePipeError(err: HttpErrors.HttpError) {
// The server side can close the socket before the client
// side can send out all data. For example, `response.end()`
// is called before all request data has been processed due
// to size limit
if (err && err.code !== 'EPIPE') throw err;
// to size limit.
// On Windows, ECONNRESET is sometimes emitted instead of EPIPE.
if (err && err.code !== 'EPIPE' && err.code !== 'ECONNRESET') throw err;
}

function givenLargeRequest() {
Expand Down

0 comments on commit ef1facd

Please sign in to comment.