Skip to content

Commit

Permalink
refactor: normalize request query for logging and fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rackstar committed Jan 7, 2025
1 parent 00b3f14 commit 0b8ef36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/routes/quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ router.get(
const period = BigNumber.from(req.query.period).mul(24 * 3600);
const coverAsset = Number(req.query.coverAsset);

console.info('Request: ', inspect(req.query, { depth: null }));
const normalizedRequestQuery = { ...req.query, amount: BigNumber.from(req.query.amount).toString() };
console.info('Request: ', inspect(normalizedRequestQuery, { depth: null }));

const store = req.app.get('store');
const route = await quoteEngine(store, productId, amount, period, coverAsset);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/routes/capacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Capacity Routes', () => {
const invalidPeriod = 10;
const poolId = 2;
const url = `/v2/capacity/pools/${poolId}?period=${invalidPeriod}`;
const { body: response } = await server.get(url).expect('Content-Type', /json/).expect(400);
const { body: response } = await server.get(url).expect('Content-Type', /json/).expect(400);
expect(response.error).to.be.equal('Invalid period: must be an integer between 28 and 365');
});

Expand Down

0 comments on commit 0b8ef36

Please sign in to comment.