Unverified Commit 869a2fe8 authored by Mohamed Belhadj's avatar Mohamed Belhadj Committed by GitHub

Change invalid internal upstream image error code (#39334)

fixes #39312
this is more consistent with other errors
an invalid image should cause a validation error and not a server error
parent b4027875
...@@ -511,7 +511,7 @@ export async function imageOptimizer( ...@@ -511,7 +511,7 @@ export async function imageOptimizer(
} }
} else { } else {
throw new ImageError( throw new ImageError(
500, 400,
'Unable to optimize image and unable to fallback to upstream image' 'Unable to optimize image and unable to fallback to upstream image'
) )
} }
......
...@@ -766,7 +766,7 @@ export function runTests(ctx) { ...@@ -766,7 +766,7 @@ export function runTests(ctx) {
const query = { url, w: ctx.w, q: 39 } const query = { url, w: ctx.w, q: 39 }
const opts = { headers: { accept: 'image/webp' } } const opts = { headers: { accept: 'image/webp' } }
const res = await fetchViaHTTP(ctx.appPort, '/_next/image', query, opts) const res = await fetchViaHTTP(ctx.appPort, '/_next/image', query, opts)
expect(res.status).toBe(500) expect(res.status).toBe(400)
expect(await res.text()).toBe( expect(await res.text()).toBe(
`Unable to optimize image and unable to fallback to upstream image` `Unable to optimize image and unable to fallback to upstream image`
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment