-
Hi, guys. How I can get the response body string from the middleware inside wrap_fn?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The highlighted lines from this example show how to read the response body: https://github.com/actix/examples/blob/master/middleware/encrypted-payloads/src/main.rs#L127-L136 Though it's important to put a body back into the response so it actually gets sent out as well: https://github.com/actix/examples/blob/master/middleware/encrypted-payloads/src/main.rs#L153-L155 I'd also recommend using |
Beta Was this translation helpful? Give feedback.
The highlighted lines from this example show how to read the response body: https://github.com/actix/examples/blob/master/middleware/encrypted-payloads/src/main.rs#L127-L136
Though it's important to put a body back into the response so it actually gets sent out as well: https://github.com/actix/examples/blob/master/middleware/encrypted-payloads/src/main.rs#L153-L155
I'd also recommend using
from_fn()
fromactix-web-lab
which is a much better developer experience than wrap_fn.