From 7f6e506f4ae5cc273733dbed936ea34d957da2f3 Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 12 Aug 2024 11:30:54 +0800 Subject: [PATCH] fixed UrlencodedParser --- lib/index.js | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 1deb997..45251e6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -278,6 +278,10 @@ export default class IncomingForm extends EventEmitter { #createUrlencodedParser() { this.#parser = new UrlencodedParser() + if (this.bytesExpected) { + this.#parser.initLength(this.bytesExpected) + } + this.#parser .on('field', fields => this.emit('field', false, fields)) .on('end', () => this.#handleEnd()) diff --git a/package.json b/package.json index ec82633..848272d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gm5/request", - "version": "2.0.6", + "version": "2.0.7", "description": "对Http的Request进一步封装, 提供常用的API", "main": "index.js", "author": "yutent",