Hi, I'm trying to test json binding and maybe I'm looking at this from the wrong angle, but I can't find the way to achieve what I want.
I would like to write some unit tests around json binding, Ideally I'd like to have a method with a json string as input and a struct as output, where I can check that the string was successfully parsed.
I want a mock context because I want to peek inside the struct, in that case, using httptest makes no sense for me because I don't want to put the marshaled struct in the response.
I hope that my intention is clear, feel free to ask for any clarification needed.
Thanks.
Nevermind, found my solution https://godoc.org/github.com/gin-gonic/gin#CreateTestContext
Most helpful comment
Nevermind, found my solution https://godoc.org/github.com/gin-gonic/gin#CreateTestContext