From 3081b2df77b60e20e88764c06d9d95a236da68b9 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 9 Mar 2015 15:33:18 +0530 Subject: [PATCH] send errors in json if accept header is application/json --- frappe/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/app.py b/frappe/app.py index 09013cd7f4..754e087825 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -79,7 +79,7 @@ def application(request): # code 409 represents conflict http_status_code = 409 - if frappe.local.is_ajax: + if frappe.local.is_ajax or 'application/json' in request.headers.get('Accept', ''): response = frappe.utils.response.report_error(http_status_code) else: frappe.respond_as_web_page("Server Error",