Skip to content

Commit

Permalink
Add comment above route
Browse files Browse the repository at this point in the history
  • Loading branch information
csuwildcat committed May 13, 2024
1 parent fd40563 commit 449075c
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/http-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ export class HttpApi {
} else {
return res.sendStatus(400);
}
}
else if (reply.status.code === 401) {
} else if (reply.status.code === 401) {
return res.sendStatus(404);
}
else {
} else {
return res.status(reply.status.code).send(reply);
}
}
Expand All @@ -129,6 +127,7 @@ export class HttpApi {
}
});

// Returns the data for the most recently published record under a given protocol path collection, if one is present
this.#api.get('/:did/read/protocols/:protocol/*', async (req, res) => {
const query = await RecordsQuery.create({
filter: {
Expand All @@ -148,15 +147,12 @@ export class HttpApi {
});
const reply = await this.dwn.processMessage(req.params.did, record.toJSON());
return readReplyHandler(res, reply);
}
else {
} else {
return res.sendStatus(404);
}
}
else if (status.code === 401) {
} else if (status.code === 401) {
return res.sendStatus(404);
}
else {
} else {
return res.sendStatus(status.code);
}
})
Expand All @@ -170,15 +166,12 @@ export class HttpApi {
if (entries.length) {
res.status(status.code);
res.json(entries[0]);
}
else {
} else {
return res.sendStatus(404);
}
}
else if (status.code === 401) {
} else if (status.code === 401) {
return res.sendStatus(404);
}
else {
} else {
return res.sendStatus(status.code);
}
})
Expand All @@ -200,11 +193,9 @@ export class HttpApi {
if (status.code === 200) {
res.status(status.code);
res.json(entries);
}
else if (status.code === 401) {
} else if (status.code === 401) {
return res.sendStatus(404);
}
else {
} else {
return res.sendStatus(status.code);
}
});
Expand Down

0 comments on commit 449075c

Please sign in to comment.