mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-21 00:35:55 +00:00
fix(nuxt): normalise error url to pathname
This commit is contained in:
parent
8109d8625b
commit
f4182359f9
@ -28,6 +28,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