Version: v0.0.0-...-21d4feb Latest Latest

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

Go to latest
Published: Apr 3, 2017 License: MIT Imports: 8 Imported by: 0




This section is empty.


View Source
var (
	// ErrInvalidContentType is returned by ParseRequest if it can't unmarshal it into the passed struct
	ErrInvalidContentType = errors.New("Invalid request content type")


func GetHTTPHost

func GetHTTPHost(r *http.Request) string

GetHTTPHost returns the currenthost in the request

func GetHTTPUrl

func GetHTTPUrl(r *http.Request) string

GetHTTPUrl returns the url in the request

func JSONResponse

func JSONResponse(w http.ResponseWriter, status int, data interface{})

JSONResponse writes JSON to an http.ResponseWriter with the corresponding status code

func ParseRequest

func ParseRequest(r *http.Request, data interface{}) error

ParseRequest takes the input body from the passed request and tries to unmarshal it into data

func RemoteAddr

func RemoteAddr(r *http.Request) string

RemoteAddr extracts the remote address of the request, taking into account proxy headers.

func RemoteIP

func RemoteIP(r *http.Request) string

RemoteIP extracts the remote IP of the request, taking into account proxy headers.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

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