Skip to content

Commit

Permalink
🐛 For url-form encoded body parser
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Nov 28, 2024
1 parent 785279c commit a9b0840
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/core/alchemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let shared_objects = {},
*
* @author Jelle De Loecker <jelle@elevenways.be>
* @since 0.0.1
* @version 1.3.21
* @version 1.4.0
*/
global.Alchemy = Function.inherits('Alchemy.Base', function Alchemy() {

Expand Down Expand Up @@ -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});
});

/**
Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit a9b0840

Please sign in to comment.