-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: middleware only and (always) handles requests at `path` BREAKING CHANGE: Only accept string payloads for `webhooks.verify()` and `webhooks.verifyAndReceive()` BREAKING CHANGE: The middleware now expects only string payloads for `request.body` BREAKING CHANGE: Only accept string payloads for `webhooks.verify()` Modifiy the `module` field in `package.json` to point to the source ESM, and adds a `browser` field that points to the browser bundle Co-authored-by: Baoshan Sheng <sheng@icmd.org>
- Loading branch information
Showing
16 changed files
with
82 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,17 @@ | ||
import { createLogger } from "../../createLogger"; | ||
import type { Webhooks } from "../../index"; | ||
import { middleware } from "./middleware"; | ||
import { onUnhandledRequestDefault } from "./on-unhandled-request-default"; | ||
import type { MiddlewareOptions } from "./types"; | ||
|
||
export function createNodeMiddleware( | ||
webhooks: Webhooks, | ||
{ | ||
path = "/api/github/webhooks", | ||
onUnhandledRequest = onUnhandledRequestDefault, | ||
log = createLogger(), | ||
}: MiddlewareOptions = {} | ||
) { | ||
const deprecateOnUnhandledRequest = (request: any, response: any) => { | ||
console.warn( | ||
"[@octokit/webhooks] `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks`" | ||
); | ||
return onUnhandledRequest(request, response); | ||
}; | ||
return middleware.bind(null, webhooks, { | ||
path, | ||
onUnhandledRequest: deprecateOnUnhandledRequest, | ||
log, | ||
} as Required<MiddlewareOptions>); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
// remove type imports from http for Deno compatibility | ||
// see https://github.com/octokit/octokit.js/issues/24#issuecomment-817361886 | ||
// import { IncomingMessage, ServerResponse } from "http"; | ||
type IncomingMessage = any; | ||
type ServerResponse = any; | ||
|
||
import type { Logger } from "../../createLogger"; | ||
|
||
export type MiddlewareOptions = { | ||
path?: string; | ||
log?: Logger; | ||
/** @deprecated `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks` */ | ||
onUnhandledRequest?: ( | ||
request: IncomingMessage, | ||
response: ServerResponse | ||
) => void; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.