Request binding

Within the context interface in the Echo framework, there is a method called Bind, which will perform request payload binding. The following is the definition of the function:

    // Bind binds the request body into provided type `i`. The default binder
    // does it based on Content-Type header.
    Bind(i interface{}) error

In essence, the Context.Bind function takes the payload and Content-Type header from the HTTP request, and converts it into any structure defined by the passed in i interface{} function parameter. This is a very handy feature of the web application framework as it removes a lot of the coding required by the developer to interpret the request payload themselves. Instead of having to perform deserialization of the ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.