From a9b08401e42b2db31101e9c8131d5c0267cbc001 Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Thu, 28 Nov 2024 14:40:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20For=20url-form=20encoded=20body?= =?UTF-8?q?=20parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/alchemy.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core/alchemy.js b/lib/core/alchemy.js index 61813ba..2882706 100644 --- a/lib/core/alchemy.js +++ b/lib/core/alchemy.js @@ -17,7 +17,7 @@ let shared_objects = {}, * * @author Jelle De Loecker * @since 0.0.1 - * @version 1.3.21 + * @version 1.4.0 */ global.Alchemy = Function.inherits('Alchemy.Base', function Alchemy() { @@ -147,7 +147,6 @@ global.Alchemy = Function.inherits('Alchemy.Base', function Alchemy() { this.text_body = this.use('body'); this.formidable = this.use('formidable'); this.body_parser = this.use('body-parser'); - this.url_form_body = this.body_parser.urlencoded({extended: true}); }); /** @@ -1879,7 +1878,12 @@ Alchemy.setMethod(function parseRequestBody(req, res, callback) { // Regular form-encoded data if (content_type && content_type.indexOf('form-urlencoded') > -1) { - this.url_form_body(req, res, {limit: request_body_size_limit}, function parsedBody(err) { + let url_form_body = this.body_parser.urlencoded({ + limit: request_body_size_limit, + extended: true, + }); + + url_form_body(req, res, function parsedBody(err) { if (err) {