wI2L / fizz

:lemon: Gin wrapper with OpenAPI 3 spec generation
https://pkg.go.dev/github.com/wI2L/fizz
MIT License
214 stars 52 forks source link

How to read the input body? #79

Open ashishb opened 2 years ago

ashishb commented 2 years ago

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?

wI2L commented 2 years ago

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.