-
Notifications
You must be signed in to change notification settings - Fork 88
test: added tests to check that the vary header contains 'RSC' #1993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
5dcb098
958fb89
2620db5
cdedf0b
f48643a
2ce423e
ba45272
73db45b
c5ed774
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,11 @@ export const getRscDataRouter = ({ routes: staticRoutes, dynamicRoutes }: Preren | |
const debug = request.headers.has('x-next-debug-logging') | ||
const log = debug ? (...args: unknown[]) => console.log(...args) : noop | ||
const url = new URL(request.url) | ||
|
||
// Set the 'vary' header to 'RSC' to ensure that we cache correctly for the different | ||
// possible content-types: application/octet-stream and text/html | ||
request.headers.set('vary', 'RSC') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be on the Response? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you're right. Not sure why I put it on the request (late night coding 🙃 ), and also not sure why my tests and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already worked. The problem isn't it returning the wrong data - that was already fixed. The problem is the browser caching the wrong data. The tests should be checking that the server is returning the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added tests to check for the vary header. Oddly enough, it looks like the vary header is working already. I removed my change and just updated tests. |
||
|
||
// If this is a static RSC request, rewrite to the data route | ||
if (request.headers.get('rsc') === '1') { | ||
log('Is rsc request') | ||
|
Uh oh!
There was an error while loading. Please reload this page.