-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove traceparent from cachekey should not remove traceparent f…
…rom original object (#64727) ### What? I submitted PR #64499 , it got merged, but it contains a mistake. I'm terribly sorry about this! By removing the traceparent from the cachekey, we mistakenly removed the header from the original object. Causing the actual request to be executed without the traceparent header. ### Why? Creating a cachekey should not alter the original object. ### How? Flip the arguments for Object.assign --------- Co-authored-by: Jeffrey <[email protected]> Co-authored-by: JJ Kasper <[email protected]>
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
test/e2e/app-dir/app-static/app/strip-header-traceparent/page.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export default async function Page() { | ||
const data1 = await fetch( | ||
'https://next-data-api-endpoint.vercel.app/api/random', | ||
{ | ||
headers: { traceparent: 'A' }, | ||
next: { revalidate: 50 }, | ||
} | ||
).then((res) => res.text()) | ||
|
||
const data2 = await fetch( | ||
'https://next-data-api-endpoint.vercel.app/api/random', | ||
{ | ||
headers: { traceparent: 'B' }, | ||
next: { revalidate: 50 }, | ||
} | ||
).then((res) => res.text()) | ||
|
||
const echoedHeaders = await fetch( | ||
'https://next-data-api-endpoint.vercel.app/api/echo-headers', | ||
{ | ||
headers: { traceparent: 'C' }, | ||
next: { revalidate: 50 }, | ||
} | ||
).then((res) => res.text()) | ||
|
||
return ( | ||
<> | ||
<p id="data1">{data1}</p> | ||
<p id="data2">{data2}</p> | ||
<p id="echoedHeaders">{echoedHeaders}</p> | ||
</> | ||
) | ||
} |