...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Size
Gzip
Dependencies
Publish
Install
@@ -236,8 +236,6 @@ | |||
| 236 | }); | 236 | }); |
| 237 | 237 | ||
| 238 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { | 238 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { |
| 239 | /*eslint func-names:0*/ | ||
| 240 | |||
| 241 | function generateHTTPMethod(isForm) { | 239 | function generateHTTPMethod(isForm) { |
| 242 | return function httpMethod(url, data, config) { | 240 | return function httpMethod(url, data, config) { |
| 243 | return this.request( | 241 | return this.request( |
@@ -14,7 +14,9 @@ | |||
| 14 | return value; | 14 | return value; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | return utils.isArray(value) ? value.map(normalizeValue) : String(value); | 17 | return utils.isArray(value) |
| 18 | ? value.map(normalizeValue) | ||
| 19 | : String(value).replace(/[\r\n]+$/, ''); | ||
| 18 | } | 20 | } |
| 19 | 21 | ||
| 20 | function parseTokens(str) { | 22 | function parseTokens(str) { |
@@ -4,8 +4,8 @@ | |||
| 4 | import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js'; | 4 | import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js'; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their | ||
| 8 | * URI encoded counterparts | 7 | * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with |
| 8 | * their plain counterparts (`:`, `$`, `,`, `+`). | ||
| 9 | * | 9 | * |
| 10 | * @param {string} val The value to be encoded. | 10 | * @param {string} val The value to be encoded. |
| 11 | * | 11 | * |
@@ -66,8 +66,10 @@ | |||
| 66 | test(() => { | 66 | test(() => { |
| 67 | let duplexAccessed = false; | 67 | let duplexAccessed = false; |
| 68 | 68 | ||
| 69 | const body = new ReadableStream(); | ||
| 70 | |||
| 69 | const hasContentType = new Request(platform.origin, { | 71 | const hasContentType = new Request(platform.origin, { |
| 70 | body: new ReadableStream(), | 72 | body, |
| 71 | method: 'POST', | 73 | method: 'POST', |
| 72 | get duplex() { | 74 | get duplex() { |
| 73 | duplexAccessed = true; | 75 | duplexAccessed = true; |
@@ -75,6 +77,8 @@ | |||
| 75 | }, | 77 | }, |
| 76 | }).headers.has('Content-Type'); | 78 | }).headers.has('Content-Type'); |
| 77 | 79 | ||
| 80 | body.cancel(); | ||
| 81 | |||
| 78 | return duplexAccessed && !hasContentType; | 82 | return duplexAccessed && !hasContentType; |
| 79 | }); | 83 | }); |
| 80 | 84 | ||
@@ -2,7 +2,7 @@ | |||
| 2 | import settle from '../core/settle.js'; | 2 | import settle from '../core/settle.js'; |
| 3 | import buildFullPath from '../core/buildFullPath.js'; | 3 | import buildFullPath from '../core/buildFullPath.js'; |
| 4 | import buildURL from '../helpers/buildURL.js'; | 4 | import buildURL from '../helpers/buildURL.js'; |
| 5 | import proxyFromEnv from 'proxy-from-env'; | 5 | import { getProxyForUrl } from 'proxy-from-env'; |
| 6 | import http from 'http'; | 6 | import http from 'http'; |
| 7 | import https from 'https'; | 7 | import https from 'https'; |
| 8 | import http2 from 'http2'; | 8 | import http2 from 'http2'; |
@@ -108,6 +108,9 @@ | |||
| 108 | } else { | 108 | } else { |
| 109 | entries.splice(i, 1); | 109 | entries.splice(i, 1); |
| 110 | } | 110 | } |
| 111 | if (!session.closed) { | ||
| 112 | session.close(); | ||
| 113 | } | ||
| 111 | return; | 114 | return; |
| 112 | } | 115 | } |
| 113 | } | 116 | } |
@@ -187,7 +190,7 @@ | |||
| 187 | function setProxy(options, configProxy, location) { | 190 | function setProxy(options, configProxy, location) { |
| 188 | let proxy = configProxy; | 191 | let proxy = configProxy; |
| 189 | if (!proxy && proxy !== false) { | 192 | if (!proxy && proxy !== false) { |
| 190 | const proxyUrl = proxyFromEnv.getProxyForUrl(location); | 193 | const proxyUrl = getProxyForUrl(location); |
| 191 | if (proxyUrl) { | 194 | if (proxyUrl) { |
| 192 | proxy = new URL(proxyUrl); | 195 | proxy = new URL(proxyUrl); |
| 193 | } | 196 | } |
@@ -1,3 +1,6 @@ | |||
| 1 | <h3 align="center"> 💎 Platinum sponsors <br> </h3> <table align="center"><tr><td align="center" width="50%"> <a href="https://thanks.dev/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="90px" height="90px" src="https://axios-http.com/assets/sponsors/opencollective/ed51c2ee8f1b70aa3484d6dd678652134079a036.png" alt="THANKS.DEV"/> </a> <p align="center" title="We're passionate about making open source sustainable. Scan your dependancy tree to better understand which open source projects need funding the most. Maintainers can also register their projects to become eligible for funding.">We're passionate about making open source sustainable. Scan your dependancy tree to better understand which open source projects need funding the...</p> <p align="center"> <a href="https://thanks.dev/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>thanks.dev</b></a> </p> | ||
| 2 | </td><td align="center" width="50%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a> | ||
| 3 | </td></tr></table> | ||
| 1 | <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>www.principal.com</b></a> </p> | 4 | <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>www.principal.com</b></a> </p> |
| 2 | </td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/dfa9670ad5e66eea17315332453c7f4e3a3b5905.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>twicsy.com</b></a> </p> | 5 | </td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/dfa9670ad5e66eea17315332453c7f4e3a3b5905.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship" target="_blank"><b>twicsy.com</b></a> </p> |
| 3 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Docs</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Community</b></a> </p> | 6 | </td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Docs</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" target="_blank"><b>Community</b></a> </p> |
@@ -497,6 +500,23 @@ | |||
| 497 | // `undefined` (default) - set XSRF header only for the same origin requests | 500 | // `undefined` (default) - set XSRF header only for the same origin requests |
| 498 | withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined), | 501 | withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined), |
| 499 | 502 | ||
| 503 | // `withXSRFToken` controls whether Axios reads the XSRF cookie and sets the XSRF header. | ||
| 504 | // - `undefined` (default): the XSRF header is set only for same-origin requests. | ||
| 505 | // - `true`: attempt to set the XSRF header for all requests (including cross-origin). | ||
| 506 | // - `false`: never set the XSRF header. | ||
| 507 | // - function: a callback that receives the request `config` and returns `true`, | ||
| 508 | // `false`, or `undefined` to decide per-request behavior. | ||
| 509 | // | ||
| 510 | // Note about `withCredentials`: `withCredentials` controls whether cross-site | ||
| 511 | // requests include credentials (cookies and HTTP auth). In older Axios versions, | ||
| 512 | // setting `withCredentials: true` implicitly caused Axios to set the XSRF header | ||
| 513 | // for cross-origin requests. Newer Axios separates these concerns: to allow the | ||
| 514 | // XSRF header to be sent for cross-origin requests you should set both | ||
| 515 | // `withCredentials: true` and `withXSRFToken: true`. | ||
| 516 | // | ||
| 517 | // Example: | ||
| 518 | // axios.get('/user', { withCredentials: true, withXSRFToken: true }); | ||
| 519 | |||
| 500 | // `onUploadProgress` allows handling of progress events for uploads | 520 | // `onUploadProgress` allows handling of progress events for uploads |
| 501 | // browser & node.js | 521 | // browser & node.js |
| 502 | onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) { | 522 | onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) { |
@@ -607,7 +627,12 @@ | |||
| 607 | transitional: { | 627 | transitional: { |
| 608 | // silent JSON parsing mode | 628 | // silent JSON parsing mode |
| 609 | // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour) | 629 | // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour) |
| 610 | // `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json') | 630 | // `false` - throw SyntaxError if JSON parsing failed |
| 631 | // Important: this option only takes effect when `responseType` is explicitly set to 'json'. | ||
| 632 | // When `responseType` is omitted (defaults to no value), axios uses `forcedJSONParsing` | ||
| 633 | // to attempt JSON parsing, but will silently return the raw string on failure regardless | ||
| 634 | // of this setting. To have invalid JSON throw errors, use: | ||
| 635 | // { responseType: 'json', transitional: { silentJSONParsing: false } } | ||
| 611 | silentJSONParsing: true, // default value for the current Axios version | 636 | silentJSONParsing: true, // default value for the current Axios version |
| 612 | 637 | ||
| 613 | // try to parse the response string as JSON even if `responseType` is not 'json' | 638 | // try to parse the response string as JSON even if `responseType` is not 'json' |