-
-
Notifications
You must be signed in to change notification settings - Fork 666
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
What is the problem this feature will solve?
The HTTP debug information for node-fetch can be turned on by setting the the environment variable NODE_DEBUG=http
:
// node-fetch.test.js
const fetch = require('node-fetch');
fetch('https://github.com')
.then(({statusText}) => console.log(statusText));
$ NODE_DEBUG=http node node-fetch.test.js
HTTP 22032: call onSocket 0 0
HTTP 22032: createConnection github.com:443::::::::::::::::::::: [Object: null prototype] {
protocol: 'https:',
slashes: true,
[redacted]
HTTP 22032: AGENT incoming response!
OK
HTTP 22032: AGENT socket.destroySoon()
HTTP 22032: CLIENT socket onClose
HTTP 22032: removeSocket github.com:443::::::::::::::::::::: writable: false
HTTP 22032: HTTP socket close
Unfortunately, there is no HTTP debug information is shown when the native fetch()
implementation is used:
// fetch.test.js
fetch('https://github.com')
.then(({statusText}) => console.log(statusText));
$ NODE_DEBUG=http node fetch.test.js
OK
Seeing the HTTP request object can be considered as useful for debugging.
What is the feature you are proposing to solve the problem?
- Either display the HTTP debug statement for the native
fetch()
whenNODE_DEBUG=http
is active or - introduce a new flag to display HTTP debug output.
What alternatives have you considered?
The native fetch()
is presenting more information when NODE_DEBUG=net,stream
is used. This information is, however, not suitable for HTTP debugging.
niklavskatlaps, johnboxall, jwoo0122, ysle, hildjj and 8 morecapaj
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request