deprecated.go 503 B

1234567891011121314151617
  1. package gin
  2. import (
  3. "github.com/gin-gonic/gin/binding"
  4. )
  5. // DEPRECATED, use Bind() instead.
  6. // Like ParseBody() but this method also writes a 400 error if the json is not valid.
  7. func (c *Context) EnsureBody(item interface{}) bool {
  8. return c.Bind(item)
  9. }
  10. // DEPRECATED use bindings directly
  11. // Parses the body content as a JSON input. It decodes the json payload into the struct specified as a pointer.
  12. func (c *Context) ParseBody(item interface{}) error {
  13. return binding.JSON.Bind(c.Req, item)
  14. }