-
Notifications
You must be signed in to change notification settings - Fork 9
fix: add support for promise-based handlers #95
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
Conversation
src/index.ts
Outdated
| * ``` | ||
| */ | ||
| export function createAsyncHandler(app: Application): (event: RequestEvent, context: Context) => Promise<ResponseResult> { | ||
| return async (event: RequestEvent, context: Context): Promise<ResponseResult> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async keyword is unnecessary since runAsync() already returns a Promise.
| return async (event: RequestEvent, context: Context): Promise<ResponseResult> => { | |
| return (event: RequestEvent, context: Context): Promise<ResponseResult> => { |
tests/integration-tests.test.ts
Outdated
| expect(result.multiValueHeaders['Content-Type']).to.eql([ 'application/json; charset=utf-8' ]); | ||
| }); | ||
|
|
||
| it('returns a Promise that rejects when an error occurs', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| it('returns a Promise that rejects when an error occurs', async () => { | |
| it('returns a Promise that resolves when an error occurs', async () => { |
9c7c415 to
f936fe0
Compare
nduthoit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.