mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
fix(formdata): fixed setting NaN as Content-Length for form payload in some cases; (#5535)
This commit is contained in:
@@ -264,7 +264,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
if (!headers.hasContentLength()) {
|
if (!headers.hasContentLength()) {
|
||||||
try {
|
try {
|
||||||
const knownLength = await util.promisify(data.getLength).call(data);
|
const knownLength = await util.promisify(data.getLength).call(data);
|
||||||
headers.setContentLength(knownLength);
|
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
||||||
/*eslint no-empty:0*/
|
/*eslint no-empty:0*/
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user