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

Commit

Permalink
Merge pull request #80 from microservices-demo/status-code-check
Browse files Browse the repository at this point in the history
Check status code for explicit 500
nustiueudinastea authored Mar 16, 2017
2 parents 62d2a17 + 1c86ced commit 7adeebc
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
@@ -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;
}
@@ -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();
@@ -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();

0 comments on commit 7adeebc

Please sign in to comment.