Access body in modifyResponse

10 views
Skip to first unread message

Brandon Martin

unread,
Jun 19, 2016, 6:28:09 PM6/19/16
to haskell-wai
I am wondering if it is possible to access the body of a response in modifyResponse? I am working on overriding ServantErr's so I can respond with a more informative json response. I have it all working other then accessing the body to get the current error message and reuse.

Michael Snoyman

unread,
Jun 20, 2016, 8:56:14 AM6/20/16
to Brandon Martin, haskell-wai

Many middlewares modify the response body, such as the gzip middleware. The tricky case to deal with is streaming responses, but it can certainly be done.


On Mon, Jun 20, 2016, 1:28 AM Brandon Martin <zmbm...@gmail.com> wrote:
I am wondering if it is possible to access the body of a response in modifyResponse? I am working on overriding ServantErr's so I can respond with a more informative json response. I have it all working other then accessing the body to get the current error message and reuse.

--
You received this message because you are subscribed to the Google Groups "haskell-wai" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-wai...@googlegroups.com.
To post to this group, send email to haske...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-wai/24a6510a-591e-481d-9ed5-a26cac02815a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brandon Martin

unread,
Jun 20, 2016, 9:08:10 AM6/20/16
to Michael Snoyman, haskell-wai
Thanks Michael, I found a solution that works for me. I will post it back later in case anyone else finds this thread. 

--
Brandon Martin
Reply all
Reply to author
Forward
0 new messages