@@ -119,8 +119,10 @@ test.describe('next/image is using Netlify Image CDN', () => {
119119
120120 expect ( nextImageResponse . status ( ) ) . toBe ( 200 )
121121 // ensure next/image is using Image CDN
122- // source image is jpg, but when requesting it through Image CDN avif will be returned
123- expect ( await nextImageResponse . headerValue ( 'content-type' ) ) . toEqual ( 'image/avif' )
122+ // source image is jpg, but when requesting it through Image CDN avif or webp will be returned
123+ expect ( [ 'image/avif' , 'image/webp' ] ) . toContain (
124+ await nextImageResponse . headerValue ( 'content-type' ) ,
125+ )
124126
125127 await expectImageWasLoaded ( page . locator ( 'img' ) )
126128 } )
@@ -142,7 +144,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
142144 )
143145
144146 expect ( nextImageResponse . status ( ) ) . toBe ( 200 )
145- expect ( await nextImageResponse . headerValue ( 'content-type' ) ) . toEqual ( 'image/avif' )
147+ expect ( [ 'image/avif' , 'image/webp' ] ) . toContain (
148+ await nextImageResponse . headerValue ( 'content-type' ) ,
149+ )
146150
147151 await expectImageWasLoaded ( page . locator ( 'img' ) )
148152 } )
@@ -164,7 +168,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
164168 )
165169
166170 expect ( nextImageResponse . status ( ) ) . toBe ( 200 )
167- expect ( await nextImageResponse . headerValue ( 'content-type' ) ) . toEqual ( 'image/avif' )
171+ expect ( [ 'image/avif' , 'image/webp' ] ) . toContain (
172+ await nextImageResponse . headerValue ( 'content-type' ) ,
173+ )
168174
169175 await expectImageWasLoaded ( page . locator ( 'img' ) )
170176 } )
@@ -183,7 +189,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
183189 )
184190
185191 expect ( nextImageResponse ?. status ( ) ) . toBe ( 200 )
186- expect ( await nextImageResponse . headerValue ( 'content-type' ) ) . toEqual ( 'image/avif' )
192+ expect ( [ 'image/avif' , 'image/webp' ] ) . toContain (
193+ await nextImageResponse . headerValue ( 'content-type' ) ,
194+ )
187195
188196 await expectImageWasLoaded ( page . locator ( 'img' ) )
189197 } )
@@ -203,7 +211,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
203211 )
204212
205213 expect ( nextImageResponse . status ( ) ) . toEqual ( 200 )
206- expect ( await nextImageResponse . headerValue ( 'content-type' ) ) . toEqual ( 'image/avif' )
214+ expect ( [ 'image/avif' , 'image/webp' ] ) . toContain (
215+ await nextImageResponse . headerValue ( 'content-type' ) ,
216+ )
207217
208218 await expectImageWasLoaded ( page . locator ( 'img' ) )
209219 } )
0 commit comments