Skip to content

Commit 24ccbfd

Browse files
wardpeetpieh
authored andcommitted
fix(gatsby-plugin-netlify): add warning instead for invalid he… (#18326)
* fix(gatsby-plugin-netlify): add warning instead of breaking when invalid header * converted to more jest like approach * fix review
1 parent 257f5d6 commit 24ccbfd

File tree

4 files changed

+324
-196
lines changed

4 files changed

+324
-196
lines changed

packages/gatsby-plugin-netlify/src/__tests__/__snapshots__/build-headers-program.js.snap

+81-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`with caching headers 1`] = `
3+
exports[`build-headers-program with badly headers configuration 1`] = `
44
"## Created with gatsby-plugin-netlify
55
66
/*
77
X-Frame-Options: DENY
88
X-XSS-Protection: 1; mode=block
99
X-Content-Type-Options: nosniff
1010
Referrer-Policy: same-origin
11+
X-Frame-Options
12+
sameorigin
1113
/component---node-modules-gatsby-plugin-offline-app-shell-js-78f9e4dea04737fa062d.js
1214
Cache-Control: public, max-age=31536000, immutable
1315
/0-0180cd94ef2497ac7db8.js
@@ -76,7 +78,83 @@ exports[`with caching headers 1`] = `
7678
"
7779
`;
7880

79-
exports[`with security headers 1`] = `
81+
exports[`build-headers-program with caching headers 1`] = `
82+
"## Created with gatsby-plugin-netlify
83+
84+
/*
85+
X-Frame-Options: DENY
86+
X-XSS-Protection: 1; mode=block
87+
X-Content-Type-Options: nosniff
88+
Referrer-Policy: same-origin
89+
/component---node-modules-gatsby-plugin-offline-app-shell-js-78f9e4dea04737fa062d.js
90+
Cache-Control: public, max-age=31536000, immutable
91+
/0-0180cd94ef2497ac7db8.js
92+
Cache-Control: public, max-age=31536000, immutable
93+
/component---src-templates-blog-post-js-517987eae96e75cddbe7.js
94+
Cache-Control: public, max-age=31536000, immutable
95+
/component---src-pages-404-js-53e6c51a5a7e73090f50.js
96+
Cache-Control: public, max-age=31536000, immutable
97+
/component---src-pages-index-js-0bdd01c77ee09ef0224c.js
98+
Cache-Control: public, max-age=31536000, immutable
99+
/pages-manifest-ab11f09e0ca7ecd3b43e.js
100+
Cache-Control: public, max-age=31536000, immutable
101+
/webpack-runtime-acaa8994f1f704475e21.js
102+
Cache-Control: public, max-age=31536000, immutable
103+
/styles.1025963f4f2ec7abbad4.css
104+
Cache-Control: public, max-age=31536000, immutable
105+
/styles-565f081c8374bbda155f.js
106+
Cache-Control: public, max-age=31536000, immutable
107+
/app-f33c13590352da20930f.js
108+
Cache-Control: public, max-age=31536000, immutable
109+
/static/*
110+
Cache-Control: public, max-age=31536000, immutable
111+
/sw.js
112+
Cache-Control: no-cache
113+
/offline-plugin-app-shell-fallback/
114+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
115+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
116+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
117+
Link: </component---node-modules-gatsby-plugin-offline-app-shell-js-78f9e4dea04737fa062d.js>; rel=preload; as=script
118+
/hi-folks/
119+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
120+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
121+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
122+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
123+
Link: </component---src-templates-blog-post-js-517987eae96e75cddbe7.js>; rel=preload; as=script
124+
/my-second-post/
125+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
126+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
127+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
128+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
129+
Link: </component---src-templates-blog-post-js-517987eae96e75cddbe7.js>; rel=preload; as=script
130+
/hello-world/
131+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
132+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
133+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
134+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
135+
Link: </component---src-templates-blog-post-js-517987eae96e75cddbe7.js>; rel=preload; as=script
136+
/404/
137+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
138+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
139+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
140+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
141+
Link: </component---src-pages-404-js-53e6c51a5a7e73090f50.js>; rel=preload; as=script
142+
/
143+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
144+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
145+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
146+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
147+
Link: </component---src-pages-index-js-0bdd01c77ee09ef0224c.js>; rel=preload; as=script
148+
/404.html
149+
Link: </webpack-runtime-acaa8994f1f704475e21.js>; rel=preload; as=script
150+
Link: </styles-565f081c8374bbda155f.js>; rel=preload; as=script
151+
Link: </app-f33c13590352da20930f.js>; rel=preload; as=script
152+
Link: </0-0180cd94ef2497ac7db8.js>; rel=preload; as=script
153+
Link: </component---src-pages-404-js-53e6c51a5a7e73090f50.js>; rel=preload; as=script
154+
"
155+
`;
156+
157+
exports[`build-headers-program with security headers 1`] = `
80158
"## Created with gatsby-plugin-netlify
81159
82160
/*
@@ -155,7 +233,7 @@ exports[`with security headers 1`] = `
155233
"
156234
`;
157235

158-
exports[`without caching headers 1`] = `
236+
exports[`build-headers-program without caching headers 1`] = `
159237
"## Created with gatsby-plugin-netlify
160238
161239
/*

0 commit comments

Comments
 (0)