Skip to content

Commit

Permalink
Return json mime type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed Jun 29, 2018
1 parent 2dbb2bf commit 59c31a6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rest-cloud",
"version": "1.0.2",
"version": "1.1.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
Expand Down
10 changes: 5 additions & 5 deletions routes/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ router.get('/getBestBlockHash', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down Expand Up @@ -125,7 +125,7 @@ router.get('/getBlockHash/:height', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down Expand Up @@ -197,7 +197,7 @@ router.get('/getDifficulty', (req, res, next) => {
}
})
.then((response) => {
res.send(JSON.stringify(response.data.result));
res.json(JSON.stringify(response.data.result));
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down Expand Up @@ -440,7 +440,7 @@ router.post('/pruneBlockchain/:height', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down Expand Up @@ -485,7 +485,7 @@ router.get('/verifyTxOutProof/:proof', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down
2 changes: 1 addition & 1 deletion routes/generating.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ router.post('/generateToAddress/:nblocks/:address', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down
4 changes: 2 additions & 2 deletions routes/mining.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ router.get('/getBlockTemplate/:templateRequest', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down Expand Up @@ -104,7 +104,7 @@ router.post('/submitBlock/:hex', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down
2 changes: 1 addition & 1 deletion routes/rawtransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ router.post('/sendRawTransaction/:hex', (req, res, next) => {
}
})
.then((response) => {
res.send(response.data.result);
res.json(response.data.result);
})
.catch((error) => {
res.send(error.response.data.error.message);
Expand Down
4 changes: 2 additions & 2 deletions test/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("#BlockchainRouter", () => {
blockchainRoute(mockRequest, mockResponse);

mockResponse.on('end', () => {
let actualResponseBody = mockResponse._getData();
let actualResponseBody = JSON.parse(mockResponse._getData());
assert.equal(actualResponseBody.length, 64);
done();
});
Expand Down Expand Up @@ -125,7 +125,7 @@ describe("#BlockchainRouter", () => {
blockchainRoute(mockRequest, mockResponse);

mockResponse.on('end', () => {
let actualResponseBody = mockResponse._getData();
let actualResponseBody = JSON.parse(mockResponse._getData());
assert.equal(actualResponseBody, "00000000000000000182bf5782f3d43b1a8fceccb50253eb61e58cba7b240edc");
done();
});
Expand Down

0 comments on commit 59c31a6

Please sign in to comment.