koajs / koa-body

koa body parser middleware
MIT License
950 stars 130 forks source link

RAW Body with Multipart? #158

Open JamesG-DPharos opened 5 years ago

JamesG-DPharos commented 5 years ago

Question

Has anyone figured out how to get the RAW Body with multipart/form requests?

I have a requirement where I need to verify an HMAC header with the RAW Body of the request. Setting the includeUnparsed flag doesn't do anything when multipart = true. Looking at the code Koa-Body skips that completely on multipart.

In addition, adding the raw-body package just clobbers body parser and results in a hang. I tried piping the stream but that doesn't seem to work.

Eg:

var stream1 = REQ.pipe(new stream.PassThrough())

Ideas?