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

Conversation

shevernitskiy
Copy link
Contributor

@shevernitskiy shevernitskiy commented Oct 12, 2023

This PR adds support for nhttp for webhook handler.

@rojvv
Copy link
Member

rojvv commented Oct 12, 2023

Does this library support returning responses from a Response instance?

@shevernitskiy
Copy link
Contributor Author

shevernitskiy commented Oct 12, 2023

Does this library support returning responses from a Response instance?

Handler signature assume the only RequestEvent as arg. Response object could be returned as well as plenty other types.
https://nhttp.deno.dev/docs/request-event/respond-with

@rojvv
Copy link
Member

rojvv commented Oct 12, 2023

We already have a Request-Response adapter. Does that suffice?

@shevernitskiy
Copy link
Contributor Author

shevernitskiy commented Oct 12, 2023

We already have a Request-Response adapter. Does that suffice?

nhttp RequestEvent has a source request object, but with consumed body. Also it has newRequest - the clone of the original one with not consumed body (this one match for basic Req => Res). But it is a clone - not good for perf and memory, obviously. So thats why I made this PR.

Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (34f0de1) 46.31% compared to head (db46875) 46.25%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #494      +/-   ##
==========================================
- Coverage   46.31%   46.25%   -0.06%     
==========================================
  Files          19       19              
  Lines        5640     5649       +9     
  Branches      227      227              
==========================================
+ Hits         2612     2613       +1     
- Misses       3025     3033       +8     
  Partials        3        3              
Files Coverage Δ
src/bot.ts 18.13% <0.00%> (ø)
src/convenience/frameworks.ts 8.16% <11.11%> (+0.09%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KnorpelSenf
Copy link
Member

@all-contributors add @shevernitskiy for their code

@allcontributors
Copy link
Contributor

@KnorpelSenf

I've put up a pull request to add @shevernitskiy! 🎉

@KnorpelSenf KnorpelSenf merged commit 469a736 into grammyjs:main Oct 14, 2023
8 checks passed
@KnorpelSenf
Copy link
Member

@shevernitskiy we usually require all contributors to sign their commits. I overruled this now and merged anyway, but please consider signing your commits in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants