Skip to content

Commit

Permalink
merge resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
cjus committed Feb 11, 2020
2 parents 238ef97 + c66a710 commit 5a1f21a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/servicerouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,16 @@ class ServiceRouter {
headers: Object.assign({}, request.headers)
};

message.body = Utils.safeJSONParse(body) || {};
if (request.headers['content-type'] === 'application/x-www-form-urlencoded') {
message.headers['content-type'] = 'application/json';
try {
message.body = querystring.parse(body.toString());
} catch (e) {
message.body = {};
}
} else {
message.body = Utils.safeJSONParse(body) || {};
}

if (request.headers['authorization']) {
message.authorization = request.headers['authorization'];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydra-router",
"version": "1.6.20",
"version": "1.7.0",
"description": "A service which routes requests to hydra-based microservices",
"author": {
"name": "Carlos Justiniano",
Expand Down

0 comments on commit 5a1f21a

Please sign in to comment.