-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Labels
Description
If the content-type header of the request is like "application/x-www-form-urlencoded; charset=UTF-8" the following logic is not functioning properly in the sendProxyRequest.js
:
if (bodyContent.length) {
var body = bodyContent;
var contentType = proxyReq.getHeader('Content-Type');
if (contentType === 'x-www-form-urlencoded' || contentType === 'application/x-www-form-urlencoded') {
try {
var params = JSON.parse(body);
body = Object.keys(params).map(function(k) { return k + '=' + params[k]; }).join('&');
} catch (e) {
// bodyContent is not json-format
}
}
What ends up happening is the bodyContent is a JSON and it gets sent improperly.
The body-parser seems to have no issues with this content-type.
The contentType detection of urlencoded should not break if there is a semi-colon followed by the charset or other segments of the contentType.
As a work around - I can add a custom proxyReqOptDecorator
and capture the content-type from the caller and "sanitize" the content-type and remove the semi-colon segment as a temporary fix. But I should not need to do that.
frost555