Skip to content

Commit

Permalink
fix: unenv uses req.body prop
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 1, 2021
1 parent 78749f2 commit a31d12f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const PayloadMethods = ['PATCH', 'POST', 'PUT'] as HTTPMethod[]
interface _IncomingMessage extends IncomingMessage {
[RawBodySymbol]?: Promise<Buffer>
ParsedBodySymbol?: any
_body?: any // unenv
body?: any // unenv
}

/**
Expand All @@ -32,8 +32,8 @@ export function useRawBody (req: _IncomingMessage, encoding: Encoding = 'utf-8')
}

// Workaround for unenv issue https://github.com/unjs/unenv/issues/8
if ('_body' in req) {
return Promise.resolve(req._body)
if ('body' in req) {
return Promise.resolve(req.body)
}

const promise = req[RawBodySymbol] = new Promise<Buffer>((resolve, reject) => {
Expand Down

0 comments on commit a31d12f

Please sign in to comment.