fix(formdata): fixed setting NaN as Content-Length for form payload in some cases; (#5535)

This commit is contained in:
Dmitriy Mozgovoy 2023-02-11 16:34:51 +02:00 committed by GitHub
parent ea87ebfe6d
commit c19f7bf770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
if (!headers.hasContentLength()) {
try {
const knownLength = await util.promisify(data.getLength).call(data);
headers.setContentLength(knownLength);
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
/*eslint no-empty:0*/
} catch (e) {
}