Skip to content

Commit

Permalink
Merge pull request #186 from anzharip/build/bump-@types/busboy
Browse files Browse the repository at this point in the history
build: bump @types-busboy
  • Loading branch information
anzharip authored Nov 1, 2021
2 parents a266d6e + 32e37f5 commit 2bd930c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"dependencies": {
"@azure/functions": "^1.2.3",
"@types/busboy": "^0.2.3",
"@types/busboy": "^0.3.1",
"@types/node": "^16.0.0",
"busboy": "^0.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ParsedMultipartFormData } from "./types/parsed-multipart-form-data.type
import { Config } from "./types/config.type";

export default async function parseMultipartFormData(
request: HttpRequest,
request: HttpRequest & { headers: { "content-type": string } },
options?: Config
): Promise<ParsedMultipartFormData> {
return new Promise((resolve, reject) => {
Expand Down
6 changes: 3 additions & 3 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "fs";
import parseMultipartFormData from "../src/index";

describe("index.js", () => {
let request: HttpRequest;
let request: HttpRequest & { headers: { "content-type": string } };

beforeEach(async () => {
const file1 = fs.readFileSync("test/fixture/dummy-data.json");
Expand All @@ -18,7 +18,7 @@ describe("index.js", () => {
method: "POST",
url: "http://localhost:7071/api/script/mongo-replace-collection",
headers: {
...body.getHeaders(),
...(body.getHeaders() as FormData.Headers & { "content-type": string }),
},
body: body.getBuffer(),
query: {},
Expand All @@ -44,7 +44,7 @@ describe("index.js", () => {
});

it("should reject the promise due to missing headers", async () => {
request.headers = {};
request.headers = {} as FormData.Headers & { "content-type": string };
expect(async () => {
await parseMultipartFormData(request);
}).rejects.toThrow();
Expand Down

0 comments on commit 2bd930c

Please sign in to comment.