utilb

package
v0.0.0-...-30b40a1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FormDecoder = form.NewDecoder()

Functions

func DeleteCookie

func DeleteCookie(w http.ResponseWriter, cookie *http.Cookie)

func GetScheme

func GetScheme(r *http.Request) string

func HeaderAccept

func HeaderAccept(h string) []string

func HeaderAcceptFirst

func HeaderAcceptFirst(v string, st ...string) string

func RandomCookieValue

func RandomCookieValue() (string, error)

func ResponseErr404

func ResponseErr404(w http.ResponseWriter)

func ResponseErr500

func ResponseErr500(w http.ResponseWriter)

func ResponseJSON

func ResponseJSON(w http.ResponseWriter, v any, code int)

func ResponseJSONAuthErr

func ResponseJSONAuthErr(w http.ResponseWriter, err error)

func ResponseJSONErr

func ResponseJSONErr(w http.ResponseWriter, err string, code int)

func ResponseJSONErr404

func ResponseJSONErr404(w http.ResponseWriter)

func ResponseJSONErr500

func ResponseJSONErr500(w http.ResponseWriter)

func ResponseJSONServiceErr

func ResponseJSONServiceErr(w http.ResponseWriter, err error)

Types

type ResError

type ResError struct {
	Error ResErrorObject `json:"error"`
}

type ResErrorObject

type ResErrorObject struct {
	Status string `json:"status,omitempty"`
	Detail string `json:"detail,omitempty"`
}

Jump to

Keyboard shortcuts

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