Skip to content

Commit 079e3fc

Browse files
committed
Make verifyAndReceive accept a string name.
As naturally comes from the relevant HTTP header.
1 parent 6531c97 commit 079e3fc

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/middleware/node/middleware.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// see https://github.com/octokit/octokit.js/issues/2075#issuecomment-817361886
33
import type { IncomingMessage, ServerResponse } from "node:http";
44

5-
import type { WebhookEventName } from "../../generated/webhook-identifiers.js";
6-
75
import type { Webhooks } from "../../index.js";
86
import type { WebhookEventHandlerError } from "../../types.js";
97
import type { MiddlewareOptions } from "./types.js";
@@ -75,7 +73,7 @@ export async function middleware(
7573
return true;
7674
}
7775

78-
const eventName = request.headers["x-github-event"] as WebhookEventName;
76+
const eventName = request.headers["x-github-event"] as string;
7977
const signatureSHA256 = request.headers["x-hub-signature-256"] as string;
8078
const id = request.headers["x-github-delivery"] as string;
8179

@@ -95,7 +93,7 @@ export async function middleware(
9593

9694
await webhooks.verifyAndReceive({
9795
id: id,
98-
name: eventName as any,
96+
name: eventName,
9997
payload,
10098
signature: signatureSHA256,
10199
});

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type EmitterWebhookEvent<
2525

2626
export type EmitterWebhookEventWithStringPayloadAndSignature = {
2727
id: string;
28-
name: WebhookEventName;
28+
name: string;
2929
payload: string;
3030
signature: string;
3131
};

0 commit comments

Comments
 (0)