next.js
next.js copied to clipboard
Returning responses from Edge API routes that with non-fully qualified URLs lead to URL parse error
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Local dev. [email protected]
What browser are you using? (if relevant)
n/a
How are you deploying your application? (if relevant)
Local dev
Describe the Bug
Responses like this from edge runtime lead to an error during local dev:
return Response(null, {
status: 302
headers: {location: "/path"}
})
This, however, is a valid HTTP response.
error - (middleware)/node_modules/next/dist/server/web/next-url.js (180:0) @ parseURL
error - Invalid URL: /en-us
Expected Behavior
Response is accepted.
Link to reproduction
n/a
To Reproduce
See above
Also experiencing this on next.js 13 (using pages instead of appDir).