Skip to content

Commit

Permalink
[489] Fixes => content-types can have semi-colons, and we need to parse
Browse files Browse the repository at this point in the history
around this.

lint
  • Loading branch information
nik-blue-lava authored and monkpow committed Sep 11, 2023
1 parent a530d14 commit fe5c2bd
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/steps/sendProxyRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,17 @@ function sendProxyRequest(Container) {

proxyReq.on('error', reject);

// this guy should go elsewhere, down the chain

if (options.parseReqBody) {
// We are parsing the body ourselves so we need to write the body content
// and then manually end the request.

//if (bodyContent instanceof Object) {
//throw new Error
//debugger;
//bodyContent = JSON.stringify(bodyContent);
//}
// We are parsing the body ourselves so we need to write the body content
// and then manually end the request.

if (bodyContent.length) {
var body = bodyContent;
var contentType = proxyReq.getHeader('Content-Type');
if (contentType === 'x-www-form-urlencoded' || contentType === 'application/x-www-form-urlencoded') {
// contentTypes may contain semi-colon
// example: "application/x-www-form-urlencoded; charset=UTF-8"

if (contentType && contentType.match('x-www-form-urlencoded')) {
try {

Check warning on line 50 in app/steps/sendProxyRequest.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Blocks are nested too deeply (4). Maximum allowed is 3

Check warning on line 50 in app/steps/sendProxyRequest.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Blocks are nested too deeply (4). Maximum allowed is 3

Check warning on line 50 in app/steps/sendProxyRequest.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Blocks are nested too deeply (4). Maximum allowed is 3
var params = JSON.parse(body);
body = Object.keys(params).map(function (k) { return k + '=' + params[k]; }).join('&');
Expand Down

0 comments on commit fe5c2bd

Please sign in to comment.