binder

package
v0.0.0-...-a8bae0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2016 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package binder provides a simple way for binding an HTTP request body to an struct.

It supports the following media types: JSON, XML, form and multipart form.

Binding is as easy as:

type MyBody struct {
    Foo string `json:"foo"`
    Bar string `json:"bar"`
}

func handler(w http.ResponseWriter, r *http.Request) {
    body := MyBody{}

    err := binder.BindBody(r, &MyBody)
}

Just give it a pointer to the http.Request and a pointer to the struct to bind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindBody

func BindBody(r *http.Request, target interface{}) error

BindBody binds the body content of the provided HTTP request into the given struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL