Skip to content

Commit a4230f5

Browse files
authored
Revert "fix: silentJSONParsing=false should throw on invalid JSON (#7253) (#7…" (#7298)
This reverts commit 7d19335.
1 parent e0a1206 commit a4230f5

2 files changed

Lines changed: 2 additions & 71 deletions

File tree

lib/defaults/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const defaults = {
108108

109109
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
110110
const silentJSONParsing = transitional && transitional.silentJSONParsing;
111-
const strictJSONParsing = !silentJSONParsing;
111+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
112112

113113
try {
114114
return JSON.parse(data, this.parseReviver);
@@ -158,4 +158,4 @@ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
158158
defaults.headers[method] = {};
159159
});
160160

161-
export default defaults;
161+
export default defaults;

test/regression_silent_json.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)