-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(context): single body overrides other returns #3800
fix(context): single body overrides other returns #3800
Conversation
@lewisedc, @cybercoder-naj pls review this PR to make sure it resolves your issue |
expect(res.headers.get('X-Foo')).toBe(null) | ||
c.header('X-Foo2', undefined) | ||
res = c.res | ||
expect(res.headers.get('X-Foo2')).toBe(null) |
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.
c.body()
now has a type of Response & TypedResponse
, so this change was made. The types are no longer compatible
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3800 +/- ##
========================================
Coverage 91.70% 91.71%
========================================
Files 160 160
Lines 10192 10195 +3
Branches 2997 2879 -118
========================================
+ Hits 9347 9350 +3
Misses 844 844
Partials 1 1 ☔ View full report in Codecov by Sentry. |
(data: Data, init?: ResponseOrInit<ContentfulStatusCode>): Response | ||
(data: null, init?: ResponseOrInit): Response | ||
<U extends ContentfulStatusCode>(data: Data, status?: U, headers?: HeaderRecord): Response & | ||
TypedResponse<unknown, U, 'body'> |
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.
@yusukebe not sure if this should remain as unknown
, could you advise pls?
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.
unknown
is OK. _data
in TypedResponse
should be unknown
in this case.
Just tested this and it's working for me! Thanks @askorupskyy |
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 thanks!
(data: Data, init?: ResponseOrInit<ContentfulStatusCode>): Response | ||
(data: null, init?: ResponseOrInit): Response | ||
<U extends ContentfulStatusCode>(data: Data, status?: U, headers?: HeaderRecord): Response & | ||
TypedResponse<unknown, U, 'body'> |
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.
unknown
is OK. _data
in TypedResponse
should be unknown
in this case.
}) | ||
|
||
type Actual = ExtractSchema<typeof router>['/']['$get']['status'] | ||
expectTypeOf<Actual>().toEqualTypeOf<204 | 201 | 200>() |
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.
This test is very good!
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!
@askorupskyy Nice! Thank you very much for handling it. @cybercoder-naj @lewisedc Thank you for the issue and the review! |
The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the codeContext
Resolves #3798