Skip to content

Commit

Permalink
Update request-digest.ts
Browse files Browse the repository at this point in the history
When using InjectHeaders, you can set odata=verbose. When pnpjs is updating X-RequestDigest, and calls _api/contextinfo, its using the injected headers, containing odata=verbose, and the code fails to set X-RequestDigest. So forcing to set the Accept parameter correctly, and not using the injected one.
  • Loading branch information
tavikukko authored Dec 20, 2023
1 parent e62c30d commit 65ec344
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/sp/behaviors/request-digest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function RequestDigest(hook?: (url: string, init: RequestInit) => IDigest

digest = await spPost(SPQueryable([this, combine(webUrl, "_api/contextinfo")]).using(JSONParse(),BatchNever()), {
headers: {
"Accept": "application/json",
"X-PnPjs-NoDigest": "1",
},
}).then(p => ({
Expand Down

0 comments on commit 65ec344

Please sign in to comment.