negotiate

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Handler gets a negotiator using the request, then renders a Payload

Types

type Negotiator

type Negotiator struct {
	ContentType string
	*render.Render
}

Negotiator wraps render and does some switching on ContentType

func GetNegotiator

func GetNegotiator(r *http.Request) *Negotiator

GetNegotiator takes a request, and figures out the ContentType from the Content-Type header

func (*Negotiator) Respond

func (n *Negotiator) Respond(w io.Writer, status int, v interface{})

Respond switches on Content Type to determine the response

type Payload

type Payload struct {
	XMLName xml.Name `xml:"payload" json:"-"`
	Status  string   `xml:"status" json:"status"`
}

Payload defines it's layout in xml and json

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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