naja-js / naja

Modern AJAX library for Nette Framework
https://naja.js.org
MIT License
109 stars 16 forks source link

Add Accept: application/json #314

Closed jiripudil closed 3 years ago

jiripudil commented 3 years ago

As suggested in #311, Naja expects responses to be JSON, so it makes sense to formalize this expectation via the Accept header:

Accept: application/json, sure, why not, Naja expects JSON anyway and breaks if anything else is returned. I'd say it should even be hardcoded the same way that X-Requested-With is. PRs welcome :wink: