1
1
describe ( 'appDir' , ( ) => {
2
2
it ( 'renders ISR appdir pages as HTML by default' , ( ) => {
3
- cy . request ( '/blog/erica/' ) . then ( ( response ) => {
3
+ cy . request ( { url : '/blog/erica/' , followRedirect : false } ) . then ( ( response ) => {
4
4
expect ( response . headers [ 'content-type' ] ) . to . match ( / ^ t e x t \/ h t m l / )
5
5
} )
6
6
} )
7
7
8
8
it ( 'renders static appdir pages as HTML by default' , ( ) => {
9
- cy . request ( '/blog/erica/first-post/' ) . then ( ( response ) => {
9
+ cy . request ( { url : '/blog/erica/first-post/' , followRedirect : false } ) . then ( ( response ) => {
10
10
expect ( response . headers [ 'content-type' ] ) . to . match ( / ^ t e x t \/ h t m l / )
11
11
} )
12
12
} )
13
13
14
14
it ( 'renders dynamic appdir pages as HTML by default' , ( ) => {
15
- cy . request ( '/blog/erica/random-post/' ) . then ( ( response ) => {
15
+ cy . request ( { url : '/blog/erica/random-post/' , followRedirect : false } ) . then ( ( response ) => {
16
16
expect ( response . headers [ 'content-type' ] ) . to . match ( / ^ t e x t \/ h t m l / )
17
17
} )
18
18
} )
@@ -23,6 +23,7 @@ describe('appDir', () => {
23
23
headers : {
24
24
RSC : '1' ,
25
25
} ,
26
+ followRedirect : false ,
26
27
} ) . then ( ( response ) => {
27
28
expect ( response . headers ) . to . have . property ( 'content-type' , 'application/octet-stream' )
28
29
} )
@@ -34,6 +35,7 @@ describe('appDir', () => {
34
35
headers : {
35
36
RSC : '1' ,
36
37
} ,
38
+ followRedirect : false ,
37
39
} ) . then ( ( response ) => {
38
40
expect ( response . headers ) . to . have . property ( 'content-type' , 'application/octet-stream' )
39
41
} )
@@ -45,29 +47,30 @@ describe('appDir', () => {
45
47
headers : {
46
48
RSC : '1' ,
47
49
} ,
50
+ followRedirect : false ,
48
51
} ) . then ( ( response ) => {
49
52
expect ( response . headers ) . to . have . property ( 'content-type' , 'application/octet-stream' )
50
53
} )
51
54
} )
52
55
53
56
it ( 'correctly redirects HTML requests for ISR pages' , ( ) => {
54
- cy . request ( '/blog/erica' ) . then ( ( response ) => {
55
- expect ( response . status ) . to . equal ( ' 308' )
57
+ cy . request ( { url : '/blog/erica' , followRedirect : false } ) . then ( ( response ) => {
58
+ expect ( response . status ) . to . equal ( 308 )
56
59
expect ( response . headers ) . to . have . property ( 'location' , '/blog/erica/' )
57
60
} )
58
61
} )
59
62
60
63
// This needs trailing slash handling to be fixed
61
64
it . skip ( 'correctly redirects HTML requests for static pages' , ( ) => {
62
- cy . request ( '/blog/erica/first-post' ) . then ( ( response ) => {
63
- expect ( response . status ) . to . equal ( ' 308' )
65
+ cy . request ( { url : '/blog/erica/first-post' , followRedirect : false } ) . then ( ( response ) => {
66
+ expect ( response . status ) . to . equal ( 308 )
64
67
expect ( response . headers ) . to . have . property ( 'location' , '/blog/erica/first-post/' )
65
68
} )
66
69
} )
67
70
68
71
it ( 'correctly redirects HTML requests for dynamic pages' , ( ) => {
69
- cy . request ( '/blog/erica/random-post' ) . then ( ( response ) => {
70
- expect ( response . status ) . to . equal ( ' 308' )
72
+ cy . request ( { url : '/blog/erica/random-post' , followRedirect : false } ) . then ( ( response ) => {
73
+ expect ( response . status ) . to . equal ( 308 )
71
74
expect ( response . headers ) . to . have . property ( 'location' , '/blog/erica/random-post/' )
72
75
} )
73
76
} )
0 commit comments