mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 04:21:39 -04:00
6
.changeset/odd-trams-make.md
Normal file
6
.changeset/odd-trams-make.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/fetch": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
When making requests for the non-abbreviated packument, add `*/*` to the `Accept` header to avoid getting a 406 error on AWS CodeArtifact [#9862](https://github.com/pnpm/pnpm/issues/9862).
|
||||
@@ -164,6 +164,7 @@
|
||||
"outfile",
|
||||
"overrider",
|
||||
"packlist",
|
||||
"packument",
|
||||
"paralleljs",
|
||||
"parallelly",
|
||||
"parseable",
|
||||
|
||||
@@ -6,8 +6,12 @@ import { fetch, isRedirect, type Response, type RequestInfo, type RequestInit }
|
||||
|
||||
const USER_AGENT = 'pnpm' // or maybe make it `${pkg.name}/${pkg.version} (+https://npm.im/${pkg.name})`
|
||||
|
||||
const ABBREVIATED_DOC = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
|
||||
const JSON_DOC = 'application/json'
|
||||
const FULL_DOC = 'application/json'
|
||||
const ACCEPT_FULL_DOC = `${FULL_DOC}; q=1.0, */*`
|
||||
|
||||
const ABBREVIATED_DOC = 'application/vnd.npm.install-v1+json'
|
||||
const ACCEPT_ABBREVIATED_DOC = `${ABBREVIATED_DOC}; q=1.0, ${FULL_DOC}; q=0.8, */*`
|
||||
|
||||
const MAX_FOLLOWED_REDIRECTS = 20
|
||||
|
||||
export interface FetchWithAgentOptions extends RequestInit {
|
||||
@@ -102,7 +106,7 @@ function getHeaders (
|
||||
}
|
||||
): Headers {
|
||||
const headers: { accept: string, authorization?: string, 'user-agent'?: string } = {
|
||||
accept: opts.fullMetadata === true ? JSON_DOC : ABBREVIATED_DOC,
|
||||
accept: opts.fullMetadata === true ? ACCEPT_FULL_DOC : ACCEPT_ABBREVIATED_DOC,
|
||||
}
|
||||
if (opts.auth) {
|
||||
headers['authorization'] = opts.auth
|
||||
|
||||
Reference in New Issue
Block a user