go-binder

module
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

README

binder

Build Status GoDoc

Simple package for binding of an HTTP request body easily to an struct.

Install

Donwload and install the package

$ go get -u github.com/marcsv/go-binder/binder

Usage

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

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.

Directories

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

Jump to

Keyboard shortcuts

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