refactor: pass entire request object to verifyQstashHeader
This commit is contained in:
@@ -16,14 +16,7 @@ import { getUpcomingTitlesFromAnilist } from "./anilist";
|
||||
const app = new Hono();
|
||||
|
||||
app.post("/", async (c) => {
|
||||
if (
|
||||
!(await verifyQstashHeader(
|
||||
env<Env, typeof c>(c, "workerd"),
|
||||
c.req.path,
|
||||
c.req.header("Upstash-Signature"),
|
||||
await c.req.text(),
|
||||
))
|
||||
) {
|
||||
if (!(await verifyQstashHeader(env<Env, typeof c>(c, "workerd"), c.req))) {
|
||||
return c.json(ErrorResponse, { status: 401 });
|
||||
}
|
||||
|
||||
|
||||
@@ -73,14 +73,7 @@ app.openapi(route, async (c) => {
|
||||
const aniListToken = c.req.header("X-AniList-Token");
|
||||
|
||||
if (isRetrying) {
|
||||
if (
|
||||
!(await verifyQstashHeader(
|
||||
env<Env, typeof c>(c, "workerd"),
|
||||
c.req.path,
|
||||
c.req.header("Upstash-Signature"),
|
||||
await c.req.text(),
|
||||
))
|
||||
) {
|
||||
if (!(await verifyQstashHeader(env<Env, typeof c>(c, "workerd"), c.req))) {
|
||||
return c.json(ErrorResponse, { status: 401 });
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user