mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-19 16:01:24 +00:00
fix(nuxt): normalise error url to pathname
This commit is contained in:
parent
d5588dbb8c
commit
87b69c9ae5
@ -29,6 +29,10 @@ export default <NitroErrorHandler> async function errorhandler (error, event, {
|
||||
}
|
||||
|
||||
const errorObject = defaultRes.body as Pick<NonNullable<NuxtPayload['error']>, 'error' | 'statusCode' | 'statusMessage' | 'message' | 'stack'> & { url: string, data: any }
|
||||
// remove proto/hostname/port from URL
|
||||
const url = new URL(errorObject.url)
|
||||
errorObject.url = url.pathname + url.search + url.hash
|
||||
// add default server message
|
||||
errorObject.message ||= 'Server Error'
|
||||
|
||||
delete defaultRes.headers['content-type'] // this would be set to application/json
|
||||
|
Loading…
Reference in New Issue
Block a user