Skip to content

Commit

Permalink
set success on status between 200 and 206
Browse files Browse the repository at this point in the history
  • Loading branch information
Claude-GP committed Apr 25, 2024
1 parent e561197 commit fa5b00d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lambda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const handler: Handler = async (payload: Payload) => {
headers: headers,
});

if (response.status === 200 || response.status === 202) {
console.log(`Alert sent to API successfully with status ${response.status}`);
if (response.status >= 200 && response.status <= 206) {
console.log(`Resquest sent to API successfully with status ${response.status}`);
} else {
console.error(`Failed to send alert to API. Status code: ${response.status}, Response: ${response.data}`);
console.error(`Failed to send resquest to API. Status code: ${response.status}, Response: ${response.data}`);
}
} catch (error) {
console.error('Error sending alert to API:', error.message);
console.error('Error sending resquest to API:', error.message);
}


Expand Down

0 comments on commit fa5b00d

Please sign in to comment.