@pnpm/network.fetch 1100.0.7 → 1100.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,7 @@ export function createFetchFromRegistry(defaultOpts) {
37
37
  ...getHeaders({
38
38
  auth: opts?.authHeaderValue,
39
39
  fullMetadata: opts?.fullMetadata,
40
+ method: opts?.method,
40
41
  userAgent: defaultOpts.userAgent,
41
42
  }),
42
43
  };
@@ -91,9 +92,13 @@ export function createFetchFromRegistry(defaultOpts) {
91
92
  };
92
93
  }
93
94
  function getHeaders(opts) {
94
- const headers = {
95
- accept: opts.fullMetadata === true ? ACCEPT_FULL_DOC : ACCEPT_ABBREVIATED_DOC,
96
- };
95
+ const headers = {};
96
+ // The abbreviated/full-metadata Accept header is meaningful only on package
97
+ // metadata reads. Setting it on writes (PUT/POST/DELETE) breaks npmjs.org's
98
+ // dist-tag endpoint, which rejects the request with a generic 400.
99
+ if (!opts.method || opts.method === 'GET' || opts.method === 'HEAD') {
100
+ headers.accept = opts.fullMetadata === true ? ACCEPT_FULL_DOC : ACCEPT_ABBREVIATED_DOC;
101
+ }
97
102
  if (opts.auth) {
98
103
  headers['authorization'] = opts.auth;
99
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/network.fetch",
3
- "version": "1100.0.7",
3
+ "version": "1100.0.8",
4
4
  "description": "Native fetch with retries",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -31,10 +31,10 @@
31
31
  "lru-cache": "^11.5.0",
32
32
  "socks": "^2.8.9",
33
33
  "undici": "^7.26.0",
34
- "@pnpm/core-loggers": "1100.1.2",
35
- "@pnpm/error": "1100.0.0",
34
+ "@pnpm/fetching.types": "1100.0.1",
36
35
  "@pnpm/types": "1101.2.0",
37
- "@pnpm/fetching.types": "1100.0.1"
36
+ "@pnpm/core-loggers": "1100.1.2",
37
+ "@pnpm/error": "1100.0.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@pnpm/logger": "^1001.0.1"
@@ -42,8 +42,8 @@
42
42
  "devDependencies": {
43
43
  "@jest/globals": "30.3.0",
44
44
  "https-proxy-server-express": "0.1.2",
45
- "@pnpm/network.fetch": "1100.0.7",
46
- "@pnpm/logger": "1100.0.0"
45
+ "@pnpm/logger": "1100.0.0",
46
+ "@pnpm/network.fetch": "1100.0.8"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=22.13"