Skip to content

Commit 572187d

Browse files
committed
[489] Fixes => content-types can have semi-colons, and we need to parse
around this. lint
1 parent 1b2f41e commit 572187d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

app/steps/sendProxyRequest.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,17 @@ function sendProxyRequest(Container) {
3636

3737
proxyReq.on('error', reject);
3838

39-
// this guy should go elsewhere, down the chain
40-
4139
if (options.parseReqBody) {
42-
// We are parsing the body ourselves so we need to write the body content
43-
// and then manually end the request.
44-
45-
//if (bodyContent instanceof Object) {
46-
//throw new Error
47-
//debugger;
48-
//bodyContent = JSON.stringify(bodyContent);
49-
//}
40+
// We are parsing the body ourselves so we need to write the body content
41+
// and then manually end the request.
5042

5143
if (bodyContent.length) {
5244
var body = bodyContent;
5345
var contentType = proxyReq.getHeader('Content-Type');
54-
if (contentType === 'x-www-form-urlencoded' || contentType === 'application/x-www-form-urlencoded') {
46+
// contentTypes may contain semi-colon
47+
// example: "application/x-www-form-urlencoded; charset=UTF-8"
48+
49+
if (contentType && contentType.match('x-www-form-urlencoded')) {
5550
try {
5651
var params = JSON.parse(body);
5752
body = Object.keys(params).map(function (k) { return k + '=' + params[k]; }).join('&');

0 commit comments

Comments
 (0)