File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -36,22 +36,17 @@ function sendProxyRequest(Container) {
36
36
37
37
proxyReq . on ( 'error' , reject ) ;
38
38
39
- // this guy should go elsewhere, down the chain
40
-
41
39
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.
50
42
51
43
if ( bodyContent . length ) {
52
44
var body = bodyContent ;
53
45
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' ) ) {
55
50
try {
56
51
var params = JSON . parse ( body ) ;
57
52
body = Object . keys ( params ) . map ( function ( k ) { return k + '=' + params [ k ] ; } ) . join ( '&' ) ;
You can’t perform that action at this time.
0 commit comments