Issue 2624 no content 204 parse (#2641)

Co-authored-by: Paul Young <paul.young@northpoint.com.au>
This commit is contained in:
Evoke-PHP 2022-01-26 07:18:02 +10:30 committed by GitHub
parent 6aeb03837d
commit 4351f62d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,7 +123,11 @@ module.exports = function($window, Promise, oncompletion) {
if (responseType === "json") {
// For IE and Edge, which don't implement
// `responseType: "json"`.
if (!ev.target.responseType && typeof args.extract !== "function") response = JSON.parse(ev.target.responseText)
if (!ev.target.responseType && typeof args.extract !== "function") {
// Handle no-content which will not parse.
try { response = JSON.parse(ev.target.responseText) }
catch (e) { response = null }
}
} else if (!responseType || responseType === "text") {
// Only use this default if it's text. If a parsed
// document is needed on old IE and friends (all