fix: Respond to /api requests as JSON by default
fix: Respond to /api requests as JSON by default

If header 'Accept: application/json' isn't set, the failure
responses to /api endpoints is HTML. Success responses are of type JSON.

(cherry picked from commit fcf63622bc0b557fdbbf4b91c30c638a7d106891)

mhbu50/frappe,saurabh6790/frappe,yashodhank/frappe,StrellaGroup/frappe,yashodhank/frappe,almeidapaulopt/frappe,yashodhank/frappe,frappe/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,saurabh6790/frappe,almeidapaulopt/frappe,StrellaGroup/frappe,StrellaGroup/frappe,frappe/frappe,saurabh6790/frappe,mhbu50/frappe,frappe/frappe,mhbu50/frappe,yashodhank/frappe,mhbu50/frappe,saurabh6790/frappe