feat: response json to curl clients on error

This commit is contained in:
Pooya Parsa 2017-08-05 12:23:06 +04:30
parent c709b22612
commit e9b66c2e41
1 changed files with 2 additions and 1 deletions

View File

@ -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) {