-
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.
Removes the
onUnhandledRequest
middleware option (#740)
* refactor(middleware)!: remove onUnhandledRequest middleware option BREAKING CHANGE: middleware only and (always) handles requests at `path` * fix(doc): document way to handle unhandled requests * refactor(middleware): remove unused type declarations
- Loading branch information
Showing
5 changed files
with
46 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
import { createLogger } from "../../createLogger"; | ||
import { Webhooks } from "../../index"; | ||
import { middleware } from "./middleware"; | ||
import { onUnhandledRequestDefault } from "./on-unhandled-request-default"; | ||
import { MiddlewareOptions } from "./types"; | ||
|
||
export function createNodeMiddleware( | ||
webhooks: Webhooks, | ||
{ | ||
path = "/api/github/webhooks", | ||
onUnhandledRequest = onUnhandledRequestDefault, | ||
log = createLogger(), | ||
}: MiddlewareOptions = {} | ||
) { | ||
return middleware.bind(null, webhooks, { | ||
path, | ||
onUnhandledRequest, | ||
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,16 +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 { Logger } from "../../createLogger"; | ||
|
||
export type MiddlewareOptions = { | ||
path?: string; | ||
log?: Logger; | ||
onUnhandledRequest?: ( | ||
request: IncomingMessage, | ||
response: ServerResponse | ||
) => void; | ||
}; |
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