Skip to content

Commit

Permalink
fix: handle requests with no account number
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Jun 12, 2024
1 parent 1f452aa commit e221c64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ async function getAccountSnapshot(accountNumber) {
app.use(async (request, response, next) => {
if (request.path !== '/') {
const accountNumber = request.path.split('/')[2];

if (!accountNumber) {
response.status(400);
return response.send('Account number is required');
}

const snapshot = await getAccountSnapshot(accountNumber);
if (!snapshot.exists) {
response.status(400);
Expand Down

0 comments on commit e221c64

Please sign in to comment.