From 1e3add0311f7af1dfbc9b9c3f1539d587ce01034 Mon Sep 17 00:00:00 2001 From: imed jaberi Date: Sun, 7 Apr 2024 05:05:58 +0100 Subject: [PATCH] fix: fix release 5.1.0 --- package.json | 5 ++++- src/body-parser.ts | 2 ++ test/middleware.test.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c9d785..230f76d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@koa/bodyparser", - "version": "5.1.0", + "version": "5.1.1", "description": "Koa body parsing middleware", "main": "./dist/index.js", "module": "./dist/index.mjs", @@ -69,6 +69,9 @@ "lodash.merge": "^4.6.2", "type-is": "^1.6.18" }, + "peerDependencies": { + "koa": "^2.14.1" + }, "engines": { "node": ">= 16" }, diff --git a/src/body-parser.ts b/src/body-parser.ts index 569a9e2..454978a 100644 --- a/src/body-parser.ts +++ b/src/body-parser.ts @@ -66,6 +66,8 @@ export function bodyParserWrapper(opts: BodyParserOptions = {}) { strict: bodyType === 'json' ? restOpts.jsonStrict : undefined, [`${bodyType}Types`]: mimeTypes[bodyType], limit: restOpts[`${shouldParseBodyAs('xml') ? 'xml' : bodyType}Limit`], + // eslint-disable-next-line unicorn/text-encoding-identifier-case + encoding: restOpts.encoding || 'utf-8', }; return parser[bodyType](ctx, parserOptions) as Promise< diff --git a/test/middleware.test.ts b/test/middleware.test.ts index 49103de..9b7f1eb 100644 --- a/test/middleware.test.ts +++ b/test/middleware.test.ts @@ -56,7 +56,7 @@ describe("test/body-parser.test.ts", () => { .expect({ foo: "bar" }); }); - it.only("should parse json body with `content-type: application/json;charset=utf-8;` headers ok", async () => { + it("should parse json body with `content-type: application/json;charset=utf-8;` headers ok", async () => { app.use(bodyParser()); app.use(async (ctx) => {