iver-wharf / iver-wharf.github.io

Documentation of Wharf
https://iver-wharf.github.io
MIT License
2 stars 0 forks source link

Dev note on gin BindJSON vs ShouldBindJSON #22

Closed applejag closed 3 years ago

applejag commented 3 years ago

We more or less only want to use ShouldBindJSON, because BindJSON also sets status code to 400 (Bad Request) and Content-Type: text/plain; charset=utf-8, and gin will spam warnings in the logs if you set those multiple times.

Docs: https://github.com/gin-gonic/gin#model-binding-and-validation