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() when NODE_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.
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_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 closeUnfortunately, there is no HTTP debug information is shown when the native
fetch()implementation is used:Seeing the HTTP request object can be considered as useful for debugging.
What is the feature you are proposing to solve the problem?
fetch()whenNODE_DEBUG=httpis active orWhat alternatives have you considered?
The native
fetch()is presenting more information whenNODE_DEBUG=net,streamis used. This information is, however, not suitable for HTTP debugging.