Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support nhttp for webhook handler #494

Merged
merged 3 commits into from
Oct 14, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/convenience/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@
unauthorized: () => res.send(401, WRONG_TOKEN_ERROR),
});

/** nhttp web framework */
const nhttp: FrameworkAdapter = (rev) => ({
update: rev.body,
header: rev.headers.get(SECRET_HEADER) || undefined,
end: () => rev.response.sendStatus(200),
respond: (json) => rev.response.status(200).send(json),
unauthorized: () => rev.response.status(401).send(WRONG_TOKEN_ERROR),
});

Check warning on line 350 in src/convenience/frameworks.ts

View check run for this annotation

Codecov / codecov/patch

src/convenience/frameworks.ts#L343-L350

Added lines #L343 - L350 were not covered by tests

// Please open a PR if you want to add another adapter
export const adapters = {
express,
Expand All @@ -359,4 +368,5 @@
"cloudflare-mod": cloudflareModule,
hono,
worktop,
nhttp,
};
Loading