feat: allow fallback to application/json
for custom registries
#314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! 👋🏼
I just ran into an issue where our custom registry doesn't support the
Accept
header value ofapplication/vnd.npm.install-v1+json
. By providing a fallback toapplication/json
,corepack
can support custom registries that don't support theapplication/vnd.npm.install-v1+json
value.I followed the article linked in the comments above this code change where it is suggested to use
application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*
for fallback. I opted to drop the*/*
since this is a json fetch implementation but feel free to change it.This was also referenced in #296 where @arcanis mentioned this would likely be fine.