fix(npm): use combined Accept header to support Artifactory upstreams - #241
Merged
Merged
Conversation
When cooldown is disabled, send: Accept: application/vnd.npm.install-v1+json;q=1.0, application/json;q=0.8 This allows upstreams like JFrog Artifactory that return 406 for the abbreviated packument type to fall back to full JSON metadata, while letting the public npm registry continue to serve the smaller abbreviated format it prefers. When cooldown is enabled, keep sending only application/json because the abbreviated format omits the "time" map required for version age filtering. Fixes git-pkgs#228 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pgarbe
force-pushed
the
fix/npm-combined-accept-header
branch
from
August 10, 2026 07:12
52b5d42 to
ced83df
Compare
pgarbe
marked this pull request as ready for review
August 10, 2026 07:12
andrew
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
application/vnd.npm.install-v1+json), breaking package metadata lookups entirely.application/json;q=0.8) lets the proxy work with both the official npm registry and stricter upstreams without sacrificing the bandwidth benefit for registries that do support the abbreviated format.What
Changed the default Accept header for npm package metadata requests from the abbreviated-only type to a combined header that prefers the smaller format but gracefully falls back to full JSON, leaving the cooldown path unchanged (it still requests full metadata exclusively).
Closes #228