-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I didn't see it mentioned in the upgrade guide
Reproduction
Steps to reproduce the behavior:
- Create an url that contains a user and password
- use fetch
- look at what was sent
- (Basic http header is missing)
import fetch from "node-fetch";
if (!globalThis.fetch) {
globalThis.fetch = fetch;
}
const baseUrl = `https://XXX:[email protected]/echo-test/zzz`;
fetch(baseUrl, {
headers: {
Accept: `application/json`,
},
}).then(response => {
if(!response.ok) {
throw response.statusText;
}
return response.text();
}).then(text => {
console.log(text);
});
Observed behavior (3.0.0)
node test.js
/echo-test/zzz Method: GET
Headers:
Host: letz.social
Connection: close
accept: application/json
accept-encoding: gzip,deflate,br
user-agent: node-fetch
Body:
Expected behavior (2.6.5)
node test.js
/echo-test/zzz Method: GET
Headers:
Host: letz.social
Connection: close
Accept: application/json
User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)
Accept-Encoding: gzip,deflate
Authorization: Basic WFhYOllZWQ==
Body:
Screenshots
Your Environment
software | version |
---|---|
node-fetch | 3.0.0 |
node | 16 |
npm | |
Operating System |
Additional context
https://letz.social/echo-test/xyz is a simple echo http server
https://github.com/GrosSacASac/echo-http-node