mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-27 13:52:38 +00:00
feat: response json to curl clients on error
This commit is contained in:
parent
c709b22612
commit
e9b66c2e41
@ -294,7 +294,8 @@ export default class Renderer extends Tapable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if request accepts JSON
|
// Check if request accepts JSON
|
||||||
const isJson = (req.headers.accept || '').toLowerCase().includes('application/json')
|
const hasReqHeader = (header, includes) => req.headers[header] && req.headers[header].toLowerCase().includes(includes)
|
||||||
|
const isJson = hasReqHeader('accept', 'application/json') || hasReqHeader('user-agent', 'curl/')
|
||||||
|
|
||||||
// Use basic errors when debug mode is disabled
|
// Use basic errors when debug mode is disabled
|
||||||
if (!this.options.render.debug) {
|
if (!this.options.render.debug) {
|
||||||
|
Loading…
Reference in New Issue
Block a user