2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

fix: silentJSONParsing=false should throw on invalid JSON (#7253) (#7257)

Co-authored-by: Rudransh Gupta <rudranshgupta@Rudranshs-MacBook-Pro.local>
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Rudransh
2025-12-06 14:15:54 +05:30
committed by GitHub
parent ec9d94e9f8
commit 7d19335e43
2 changed files with 71 additions and 2 deletions
+2 -2
View File
@@ -108,7 +108,7 @@ const defaults = {
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
const silentJSONParsing = transitional && transitional.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
const strictJSONParsing = !silentJSONParsing;
try {
return JSON.parse(data, this.parseReviver);
@@ -158,4 +158,4 @@ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
defaults.headers[method] = {};
});
export default defaults;
export default defaults;