File tree 2 files changed +42
-1
lines changed
cypress/integration/default
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1
1
describe ( 'custom headers' , ( ) => {
2
- it ( 'should load custom headers' , ( ) => {
2
+ it ( 'should load custom headers for an SSG page ' , ( ) => {
3
3
cy . request ( '/' ) . then ( ( request ) => {
4
4
cy . wrap ( request . headers [ 'x-custom-header' ] ) . should ( 'equal' , 'my custom header value' )
5
+ cy . wrap ( request . headers [ 'x-custom-header-for-everything' ] ) . should (
6
+ 'equal' ,
7
+ 'my custom header for everything value' ,
8
+ )
9
+ } )
10
+ } )
11
+
12
+ it ( 'should load custom headers for a Netlify function' , ( ) => {
13
+ cy . request ( '/api/hello/' ) . then ( ( request ) => {
14
+ cy . wrap ( request . headers [ 'x-custom-api-header' ] ) . should ( 'equal' , 'my custom api header value' )
15
+ cy . wrap ( request . headers [ 'x-custom-header-for-everything' ] ) . should (
16
+ 'equal' ,
17
+ 'my custom header for everything value' ,
18
+ )
19
+ } )
20
+ } )
21
+
22
+ it ( 'should load custom headers for an SSR page' , ( ) => {
23
+ cy . request ( '/shows/250' ) . then ( ( request ) => {
24
+ cy . wrap ( request . headers [ 'x-custom-header-for-everything' ] ) . should (
25
+ 'equal' ,
26
+ 'my custom header for everything value' ,
27
+ )
5
28
} )
6
29
} )
7
30
} )
Original file line number Diff line number Diff line change @@ -19,6 +19,24 @@ module.exports = {
19
19
} ,
20
20
] ,
21
21
} ,
22
+ {
23
+ source : '/api/:path*' ,
24
+ headers : [
25
+ {
26
+ key : 'x-custom-api-header' ,
27
+ value : 'my custom api header value' ,
28
+ } ,
29
+ ] ,
30
+ } ,
31
+ {
32
+ source : '/:path*' ,
33
+ headers : [
34
+ {
35
+ key : 'x-custom-header-for-everything' ,
36
+ value : 'my custom header for everything value' ,
37
+ } ,
38
+ ] ,
39
+ } ,
22
40
]
23
41
} ,
24
42
trailingSlash : true ,
You can’t perform that action at this time.
0 commit comments