- With issues:
- Use the search tool before opening a new issue.
- Please provide source code and commit sha if you found a bug.
- Review existing issues and provide feedback or react to them.
Description
If I want to perform binding operations on the request body multiple times, I think I should use ShouldBindBodyWith ()
, but each operation needs to specify the type, such as binding.JSON
, so I think can we provide separate APIs for each type? For example, ShouldBindBodyWithJson()
to operate on data of type binding.JSON
, which can be used more conveniently in upper-level development
How to reproduce
Expectations
$ curl http://localhost:9000/hello/world
Hello world
Actual result
$ curl -i http://localhost:9000/hello/world
<YOUR RESULT>
Environment
- go version: latest
- gin version (or commit ref):
- operating system:
Comment From: RedCrazyGhost
Please describe the benefits that this proposal can bring in order to have a full understanding of the need for its development.
You can use the ShouldBindXXX(obj any) method to process the data in the request body
Comment From: RedCrazyGhost
Regarding your proposal, I thought about it for a while, and if other types of approaches were provided, it could really improve the development experience.
I'm currently experiencing some problems where parsing JSON content is something that doesn't meet my expectations, and I can only wait for someone else's answer.(See Issue)