This URL returns a code 301 to wget and curl, but node-fetch is reporting 200:
# wget https://www.h24info.ma/feed
--2021-03-19 11:30:23-- https://www.h24info.ma/feed
Resolving www.h24info.ma (www.h24info.ma)... 104.21.39.120, 172.67.145.67, 2606:4700:3030::6815:2778, ...
Connecting to www.h24info.ma (www.h24info.ma)|104.21.39.120|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
# curl -I https://www.h24info.ma/feed
HTTP/2 301
But fetch returns 200 (and hangs forever) :
fetch('https://www.h24info.ma/feed', {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36',
'accept': 'text/html,application/xhtml+xml'
}).then(function (res) {
console.error('node-fetch status: %s', res.status);
});
node-fetch status: 200
Am I missing something? Fetch should return 301 so the request can be aborted and the error dealt with.
| software | version |
|---|---|
| node-fetch | 2.6.1 |
| node | v14.15.3 |
| npm | 7.6.0 |
| Operating System | Linux 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64 GNU/Linux |