minor refactor to ServerUtilityService.addMultipartFormDataContentType

This commit is contained in:
Hazelnoot 2025-05-06 20:24:14 -04:00
parent 3b44e11799
commit f7ca7a2cc0

View file

@ -45,14 +45,12 @@ export class ServerUtilityService {
if (typeof(v) !== 'string') continue;
// This is just progressive conversion from undefined -> string -> string[]
if (body[k]) {
if (Array.isArray(body[k])) {
body[k].push(v);
} else {
body[k] = [body[k], v];
}
} else {
if (!body[k]) {
body[k] = v;
} else if (Array.isArray(body[k])) {
body[k].push(v);
} else {
body[k] = [body[k], v];
}
} else { // Otherwise it's a file
try {