Skip to content

Commit

Permalink
fix: breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
izatop committed Dec 1, 2022
1 parent e0917a5 commit 977a813
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const MultipartFormDataTransform = async <T = unknown>(request: IRequest)
request.headers.assert("Content-Type", (value) => value.startsWith("multipart/form-data"));
const bb = busboy({headers: request.headers.toJSON()});
const rs = await request.createReadableStream();
const defer = new Defer<unknown>();
const defer = new Defer<void>();
const result: Record<string, any> = {};
const pending: Defer<void>[] = [];

Expand Down Expand Up @@ -41,11 +41,12 @@ export const MultipartFormDataTransform = async <T = unknown>(request: IRequest)
.on("close", () => def.resolve());
})
.on("field", (name, value) => inject(parseFieldName(name), value, result))
.on("close", () => defer.resolve(result));
.on("close", () => defer.resolve());

rs.pipe(bb);

await defer;
await Promise.all(pending);

return defer.then((res) => res as T);
return result as any;
};

0 comments on commit 977a813

Please sign in to comment.