decord/source/1132_parseContentLengthHeader.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1132
// Function ID: 1133
// Name: parseContentLengthHeader
// Dependencies: [1004]
// Module 1132 (parseContentLengthHeader)
2026-08-24 06:08:38 +00:00
import encodeUTF8 from "encodeUTF8" /* 1004 */;
require = arg1;
2026-07-29 08:29:29 +00:00
const dependencyMap = arg6;
arg5.parseContentLengthHeader = function parseContentLengthHeader(responseHeader) {
if (responseHeader) {
const _parseInt = parseInt;
const parsed = parseInt(responseHeader, 10);
const _isNaN = isNaN;
let tmp3;
if (!isNaN(parsed)) {
tmp3 = parsed;
}
return tmp3;
}
};
2026-08-04 21:03:28 +00:00
arg5.getBodySize = function getBodySize(json) {
if (json) {
2026-07-29 08:29:29 +00:00
try {
2026-08-04 21:03:28 +00:00
if (typeof json === "string") {
2026-08-24 06:08:38 +00:00
return encodeUTF8.encodeUTF8(json).length;
2026-07-29 08:29:29 +00:00
} else {
const _URLSearchParams = URLSearchParams;
2026-08-04 21:03:28 +00:00
if (json instanceof URLSearchParams) {
2026-08-24 06:08:38 +00:00
return encodeUTF8.encodeUTF8(json.toString()).length;
2026-07-29 08:29:29 +00:00
} else {
const _FormData = FormData;
2026-08-04 21:03:28 +00:00
if (json instanceof FormData) {
const tmp = (function _serializeFormData(json) {
return new URLSearchParams(json).toString();
})(json);
2026-08-24 06:08:38 +00:00
return encodeUTF8.encodeUTF8(tmp).length;
2026-07-29 08:29:29 +00:00
} else {
const _Blob = Blob;
2026-08-04 21:03:28 +00:00
if (json instanceof Blob) {
return json.size;
2026-07-29 08:29:29 +00:00
} else {
const _ArrayBuffer = ArrayBuffer;
2026-08-04 21:03:28 +00:00
if (json instanceof ArrayBuffer) {
return json.byteLength;
2026-07-29 08:29:29 +00:00
}
}
}
}
}
} catch (err) {
}
}
};