Files
discord-decomp/_bundle/FormData.js
T
2026-11-01 12:12:55 +02:00

57 lines
1.4 KiB
JavaScript

// Metro module 211 (f212).
import _classCallCheck from "./_classCallCheck";
import _createClass from "./_createClass";
let env231 = {};
const FormData2 = function() {
_classCallCheck(this, FormData2);
this._parts = [];
};
export default _createClass(FormData2, [{
key: "append",
value: function append(a0, a1) {
this._parts.push([a0, a1]);
}
}, {
key: "getAll",
value: function getAll(c23607_0) {
return this._parts.filter((_part) => {
const [r8] = _part;
return r8 === c23607_0;
}).map((item) => {
const [, r12] = item;
return r12;
});
}
}, {
key: "getParts",
value: function getParts() {
return this._parts.map((_part) => {
let r51;
const [fieldName, r8] = _part;
const headers = {
"content-disposition": "form-data; name=\"" + fieldName + "\""
};
if (typeof r8 === "object" && (!Array.isArray(r8) && r8)) {
if (typeof r8.name === "string") {
headers["content-disposition"] = headers["content-disposition"] + `; filename="${encodeURIComponent(r8.name.replace(/\//g, "_"))}"`;
}
if (typeof r8.type === "string") {
headers["content-type"] = r8.type;
}
r51 = {
...r8,
headers,
fieldName
};
} else {
r51 = {
string: String(r8),
headers,
fieldName
};
}
return r51;
});
}
}]);