Skip to content

Commit

Permalink
Update addScansByPage.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
azdak committed Nov 25, 2024
1 parent 0ae4346 commit 46936af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/routes/addScansByPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ urls:

export const addScansByPage = async ({ request, reply }) => {

const data = JSON.parse(request.body);
// check request
if (!request.body.urls) {
if (!data.urls) {
return {
status: "error",
message: "An array of URLs to send is required."
};
} else {
for (const urlObj of request.body.urls as Array<UrlForScan>) {
for (const urlObj of data.urls as Array<UrlForScan>) {
if (!validateUrl(urlObj.url)) {
return {
status: "error",
Expand All @@ -49,7 +50,7 @@ export const addScansByPage = async ({ request, reply }) => {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
urls: request.body.urls,
urls: data.urls,
userId: jwtClaims.sub,
}),
}
Expand Down

0 comments on commit 46936af

Please sign in to comment.