Skip to content

Commit

Permalink
fix(enhance): body exist
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwangchong committed Aug 9, 2023
1 parent 6da727d commit cadb259
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/enhance/src/context/handers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ interface ConsideredRequest {
*/
export const enhanceBody = (ctx: KoaContext): Context => {
ctx.getBody = <T>(key?: string): T | undefined => {
ctx.header
const { method, body } = ctx.request as unknown as ConsideredRequest
if (method === 'post' && body) {
if (method === 'POST' && body) {
if (key) {
return body[key] as T
}
Expand Down

0 comments on commit cadb259

Please sign in to comment.