-
Notifications
You must be signed in to change notification settings - Fork 10.3k
fix(gatsby-adapter-netlify): adapter use headerRoutes #38652
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3f4eef1
simplified header rules
kathmbeck 6bf8782
lint
kathmbeck 342f1aa
Merge branch 'master' into adapter-header-rules
kathmbeck 20cc896
lint
kathmbeck b58b9f7
update test/snapshot
kathmbeck 45b6f5e
update snapshot
kathmbeck 66859d6
Merge branch 'master' into adapter-header-rules
kathmbeck 5254cb8
add snapshot for headerRoutes
kathmbeck 1db7da7
Merge branch 'master' into adapter-header-rules
kathmbeck c1d54ae
adapter use headerRoutes
kathmbeck feee869
export type
kathmbeck cbbe1da
Merge branch 'adapter-header-rules' into use-header-routes
kathmbeck 333e960
first pass at headers tests
kathmbeck c69f76a
Merge branch 'master' into use-header-routes
kathmbeck 5627ed6
Merge branch 'use-header-routes' of https://github.com/gatsbyjs/gatsb…
kathmbeck d08a337
merge conflict fix
kathmbeck 0beb1ab
lint error
kathmbeck d3555e6
remove accidental nesting
kathmbeck 763cd13
tests
kathmbeck 9578dec
tests
kathmbeck fe00ca5
static assets todo
kathmbeck c1a9ffd
example of permanent caching header assertion
pieh 90694c1
ensure getServerData header has priority over config header for SSR p…
pieh 5063e03
normalize header values before assertions
pieh 6257dd8
add page- and app-data header checks
pieh 58d94cb
tmp: skip deleting deploys for easier iteration
pieh e05986d
refactor test a bit so it's easier to assert same thing in multiple t…
pieh 0353fe9
add slice-data headers check
pieh 150e4e9
add static query result header test
pieh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,54 @@ | ||
| import { title } from "../../constants" | ||
|
|
||
| describe("Headers", () => { | ||
| function checkHeaders(routeAlias, expectedHeaders) { | ||
| cy.wait(routeAlias).then(interception => { | ||
| Object.keys(expectedHeaders).forEach(headerKey => { | ||
| expect(interception.response.headers[headerKey]).to.eq( | ||
| expectedHeaders[headerKey] | ||
| ) | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| const defaultHeaders = { | ||
| "x-xss-protection": "1; mode=block", | ||
| "x-content-type-options": "nosniff", | ||
| "referrer-policy": "same-origin", | ||
| "x-frame-options": "DENY", | ||
| } | ||
|
|
||
| it("should contain correct headers for index page", () => { | ||
| cy.intercept("/").as("index") | ||
| cy.visit("/") | ||
|
|
||
| checkHeaders("@index", { | ||
| ...defaultHeaders, | ||
| "x-custom-header": "my custom header value", | ||
| }) | ||
| }) | ||
|
|
||
| // it("should contain correct headers for static assets", () => { | ||
| // @todo | ||
| // }) | ||
|
|
||
| it("should contain correct headers for ssr page", () => { | ||
| cy.intercept("routes/ssr/static").as("ssr") | ||
| cy.visit("routes/ssr/static") | ||
|
|
||
| checkHeaders("@ssr", { | ||
| ...defaultHeaders, | ||
| "x-ssr-header": "my custom header value from config", | ||
| }) | ||
| }) | ||
|
|
||
| it("should contain correct headers for dsg page", () => { | ||
| cy.intercept("routes/dsg/static").as("dsg") | ||
| cy.visit("routes/dsg/static") | ||
|
|
||
| checkHeaders("@dsg", { | ||
| ...defaultHeaders, | ||
| "x-dsg-header": "my custom header value", | ||
| }) | ||
| }) | ||
| }) | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.