Skip to content

Commit

Permalink
fix: improve typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingxi01 committed Jan 17, 2025
1 parent 004ae0e commit ab0e4f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/http/src/validator/validators/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ export function parseMultipartFormDataParams(
// This code handles the case where the same key is used multiple times in the multipart/form-data request
// for representing an array of values.
if (result[key]) {
if (Array.isArray(result[key])) {
(result[key] as string[]).push(value);
const existingValue: string | string[] = result[key];
if (Array.isArray(existingValue)) {
existingValue.push(value);
} else {
result[key] = [result[key] as string, value];
result[key] = [existingValue, value];
}
} else {
result[key] = value;
Expand Down

0 comments on commit ab0e4f5

Please sign in to comment.