-
Notifications
You must be signed in to change notification settings - Fork 2
Description
current code for each endpoint follows the structure below (which is expecting query parameters named "ex" and "interval"):
if ( ! req.query ) {
// return status 400 with error message
} else {
var ex = req.query.ex;
var interval = req.query.interval;
// do something
}
the code does not signal an error if a query parameter other then "ex" or "interval" appears in the URL.
also, valid values are not being checked for "ex" or "interval".
reviewer: ?
for those endpoints expecting a query parameter, when no query string exists in the URL, some endpoints (e.g. /exchange/pairs) return HTML (excerpted below) and others (e.g. /exchange/depth) return an error message from node (excerpted below).
HTML excerpt:
<h1>Cannot read property 'split' of undefined
<h2></h2>
<pre>TypeError: Cannot read property 'split' of undefined
at exports.pairs (/home/jmills/portal/code/CryptoMarketAPI/controllers/exchange.controller.js: 38: 31)
at Layer.handle [as handle_request
] (/home/jmills/portal/code/CryptoMarketAPI/node_modules/express/lib/router/layer.js: 95: 5)
error message excerpt:
(node:1272) UnhandledPromiseRejectionWarning: TypeError: ccxt[ex] is not a constructor
at CryptoMarketAPI/controllers/exchange.controller.js:111:28
at exports.depth (CryptoMarketAPI/controllers/exchange.controller.js:119:12)
at Layer.handle [as handle_request] (CryptoMarketAPI/node_modules/express/lib/router/layer.js:95:5)