From 53e8ff43d90a2096b484d61a11801abe819eb1c2 Mon Sep 17 00:00:00 2001 From: Dmitriy Mozgovoy Date: Mon, 19 Apr 2021 23:05:48 +0300 Subject: [PATCH] Feat/json improvements (#3763) * Draft * Added support for primitive types to be converted to JSON if the request Content-Type is 'application/json'; Added throwing SyntaxError if JSON parsing failed and responseType is json; Added transitional option object; Added options validator to assert transitional options; Added transitional option `silentJSONParsing= true` for backward compatibility; Updated README.md; Updated typings; * Fixed isOlderVersion helper; Fixed typo; Added validator.spec.js; * Added forcedJSONParsing transitional option #2791 * `transformData` is now called in the default configuration context if the function context is not specified (for tests compatibility); * Added `transitional.clarifyTimeoutError` to throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts; Added support of onloadend handler if available instead of onreadystatechange; Added xhr timeout test; Fixed potential bug of xhr adapter with proper handling timeouts&errors (FakeXMLHTTPRequest failed to handle timeouts); * Removed unnecessary assertion; --- test/specs/transform.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/specs/transform.spec.js b/test/specs/transform.spec.js index 86d5b5344b..6f81f46944 100644 --- a/test/specs/transform.spec.js +++ b/test/specs/transform.spec.js @@ -64,7 +64,6 @@ describe('transform', function () { setTimeout(function () { expect(thrown).toBeTruthy(); expect(thrown.name).toContain('SyntaxError'); - expect(thrown.message).toContain('JSON'); done(); }, 100); });