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

Update to oak new request.body API #547

Closed
gabelluardo opened this issue Mar 25, 2024 · 4 comments · Fixed by #548
Closed

Update to oak new request.body API #547

gabelluardo opened this issue Mar 25, 2024 · 4 comments · Fixed by #548

Comments

@gabelluardo
Copy link
Contributor

When I try to use oak on Deno Deploy I have this error message at runtime

immagine

seems like an incompatibility issue with the new API oakserver/oak#634

@KnorpelSenf
Copy link
Member

That sounds reasonable. Could you open a pull request to fix it? :)

@gabelluardo
Copy link
Contributor Author

Yeah, sure, can you give me a hint of what these functions do, so I know how to modify it?

const oak: FrameworkAdapter = (ctx) => ({
update: ctx.request.body({ type: "json" }).value,
header: ctx.request.headers.get(SECRET_HEADER) || undefined,
end: () => {
ctx.response.status = 200;
},
respond: (json) => {
ctx.response.type = "json";
ctx.response.body = json;
},
unauthorized: () => {
ctx.response.status = 401;
},
});

@KnorpelSenf
Copy link
Member

Absolutely. Those functions make up the interface between grammY and each web framework. They define how to obtain the update object from the Bot API's webhook request, and provide several ways to respond to the webhook request.

Here is the definition of the interface with documentation for every field. Also, you will find numerous examples in the same file, illustrating how to use them.

@KnorpelSenf
Copy link
Member

You may also find https://github.com/grammyjs/grammY/blob/main/CONTRIBUTING.md#coding useful

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 a pull request may close this issue.

2 participants