fizz icon indicating copy to clipboard operation
fizz copied to clipboard

How to read the input body?

Open ashishb opened this issue 3 years ago • 1 comments

I have some path and query fields mapped to well-defined types like int and string. However, I want to read the request body as []byte or ideally, as map[string][]string. It seems c.Request.Body is non-empty in middleware but it is empty inside my gin routes wrapped in Fizz. What's the best way to access the body inside the handler?

ashishb avatar May 28 '22 07:05 ashishb

What you want to achieve defeat the purpose of tonic/fizz, since the binding is supposed to be done for you. And since the body reader is consumed and closed by the tonic wrapper, it's not possible.

wI2L avatar Aug 18 '22 17:08 wI2L