request: remove 404 HTTP status code on failed npm requests
privatenumber opened this issue ยท 5 comments
When using getting the npm monthly downloads, new packages return a 404 HTTP status. For example: https://badgen.net/npm/dm/fs.promises.exists
The 404 HTTP status code prevents the image from being embedded at all, showing a broken image instead:
I would much rather have the 404 npm badge displayed (via HTTP status code 200) temporarily than a broken image embed.
Is it possible to remove the 404 status code?
Happy to PR if so.
The 404 HTTP status code prevents the image from being embedded at all, showing a broken image instead
Are you sure that the actual response status code is 404? I did a quick test using:
curl -i https://badgen.net/npm/dm/fs.promises.exists
and got back badge with 500 instead ๐
My mistake, I meant 500. (Got confused since the text displays 404).
Would like it to return 200 instead, because it's responding with an image worth displaying/embedding.
I would much rather have the 404 npm badge displayed (via HTTP status code 200) temporarily than a broken image embed.
Is it possible to remove the 404 status code?
Happy to PR if so.
With that being said I don't know what @amio thinks about it but to me, it makes sense to go with a successful response code with an on-badge error indication due to reasons you just explained and because shields.io does the same.
Error handling in general needs some love ๐
it makes sense to go with a successful response code with an on-badge error indication
Overall I'm agree with this ๐
IIRC GitHub would cache image with status code 200 for hours, that's the reason I made it an error response, to prevent GitHub cache an incorrect badge.