Skip to content

Conversation

martinwcf
Copy link
Contributor

@martinwcf martinwcf commented Aug 27, 2025

@martinwcf martinwcf changed the title MinorFix (minor) error message HTTP response status code in image src setter Fix (minor) error message HTTP response status code in image src setter Aug 27, 2025
@pranav1344
Copy link
Contributor

What exactly are you trying to fix with this PR?

According to Node Fetch API documentation, using res.statusCode is the correct way to get the status code of a request sent using a call to fetch().

@martinwcf
Copy link
Contributor Author

What exactly are you trying to fix with this PR?

According to Node Fetch API documentation, using res.statusCode is the correct way to get the status code of a request sent using a call to fetch().

Hello Pranav,

Apparently the Node Fetch API documentation examples seems to be wrong!

You can quickly corroborate it in the REPL await fetch('http://github.com').

See that empirically there is no statusCode, but there is a status. I was getting undefined from node-canvas message every time. The MDN fetch API seems to be the correct one.
Tried it on node 18, 20 and 24. There was no fetch included before 18 I believe.

@LinusU
Copy link
Collaborator

LinusU commented Oct 10, 2025

According to MDN the correct value is status: https://developer.mozilla.org/en-US/docs/Web/API/Response/status

@chearon chearon merged commit 7f34c9b into Automattic:master Oct 10, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants