Skip to content

Instantly share code, notes, and snippets.

@shuhei
Last active August 4, 2021 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhei/a34e0cb0b7eee29794e1536a290bb645 to your computer and use it in GitHub Desktop.
Save shuhei/a34e0cb0b7eee29794e1536a290bb645 to your computer and use it in GitHub Desktop.
axios' behaviors when the server hangs up or destroys the connection after sending response headers

Test cases

https://github.com/shuhei/axios/commit/b13cc2bc7b36bc6b653cba4005580f1845550564

Results

Node v12.22.4

$ yarn test
(...snip...)

  41 passing (2s)
  2 failing

  2 failing

  1) supports http with nodejs
       should timeout if server hangs after sending response headers:
     Error: request should not succeed
      at /Users/shuheikagawa/work/js/axios/test/unit/adapters/http.js:979:14
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

  2) supports http with nodejs
       should reject if server destroys connection after sending response headers:
     Error: request should not succeed
      at /Users/shuheikagawa/work/js/axios/test/unit/adapters/http.js:994:14
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

Node v14.15.4

$ yarn test
(...snip...)

  41 passing (1m)
  2 failing

  1) supports http with nodejs
       should timeout if server hangs after sending response headers:
     Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/shuheikagawa/work/js/axios/test/unit/adapters/http.js)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)

  2) supports http with nodejs
       should reject if server destroys connection after sending response headers:
     Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/shuheikagawa/work/js/axios/test/unit/adapters/http.js)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment