Skip to content

Commit

Permalink
Handle api response (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
cultpodcasts committed Aug 12, 2024
1 parent a72df2a commit 729fec0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,12 @@ app.post("/podcast/index/:name", auth0Middleware, async (c) => {
if (resp.status == 202) {
console.log(`Successfully used secure-podcast-index-endpoint.`);
return new Response(resp.body);
} else if (resp.status == 404) {
console.log(`Successfully used secure-podcast-index-endpoint. Not Found.`);
return new Response(resp.body, { status: resp.status });
} else if (resp.status == 400) {
console.log(`Successfully used secure-podcast-index-endpoint. Not Performed.`);
return new Response(resp.body, { status: resp.status });
} else {
console.log(`Failed to use secure-podcast-index-endpoint. Response code: '${resp.status}'.`);
return c.json({ error: "Error" }, 500);
Expand Down

0 comments on commit 729fec0

Please sign in to comment.