Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Check status code for explicit 500
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal Lal committed Mar 15, 2017
1 parent 62d2a17 commit 1c86ced
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/orders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
async.waterfall([
function (callback) {
request(endpoints.customersUrl + "/" + custId, function (error, response, body) {
if (error || response.status_code === "500") {
if (error || body.status_code === 500) {
callback(error);
return;
}
Expand Down Expand Up @@ -87,7 +87,7 @@
}
console.log("Received response: " + JSON.stringify(body));
var jsonBody = JSON.parse(body);
if (jsonBody._embedded.address[0] != null) {
if (jsonBody.status_code !== 500 && jsonBody._embedded.address[0] != null) {
order.address = jsonBody._embedded.address[0]._links.self.href;
}
callback();
Expand All @@ -102,7 +102,7 @@
}
console.log("Received response: " + JSON.stringify(body));
var jsonBody = JSON.parse(body);
if (jsonBody._embedded.card[0] != null) {
if (jsonBody.status_code !== 500 && jsonBody._embedded.card[0] != null) {
order.card = jsonBody._embedded.card[0]._links.self.href;
}
callback();
Expand Down

0 comments on commit 1c86ced

Please sign in to comment.