httputil

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r *http.Request, v interface{}) error

func DecodeFormValue

func DecodeFormValue(r *http.Request, key string, v interface{}) error

func DecodeJSON

func DecodeJSON(r io.Reader, v interface{}) error

func JSON

func JSON(w http.ResponseWriter, r *http.Request, v interface{})

func NewError

func NewError(w http.ResponseWriter, code int, err error) bool

NewError example

func Respond

func Respond(w http.ResponseWriter, r *http.Request, v interface{})

Types

type Error

type Error struct {
	Message          string `json:"error"`
	ErrorDebug       string `json:"error_debug,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
	StatusCode       int    `json:"status_code,omitempty"`
}

Error example

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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