koajs/compress

Save pre-compressed body for logging

UnbrandedTech opened this issue · 1 comments

Right now, I have to choose between compressing my responses and logging them...

I tried to go down the road of unzipping/inflating them after, but decided that maybe the library could help out a bit.

I purpose something along the lines of adding a new prop onto the response object called pre_compressed_body or something similar so if someone wants to log the response they can.

this can be done with another middleware after compress in the stack. put something like this after the compress middleware https://github.com/koajs/logger/blob/6bec1297e3040c2c90724bda716e2c66bfad303e/index.js#L77-L100