http

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeader

func GetHeader(r *http.Request, key string) string

func GetHeaderOr

func GetHeaderOr(r *http.Request, key string, defaultValue string) string

func GetQueryBool

func GetQueryBool(r *http.Request, key string) (bool, error)

func GetQueryBoolOr

func GetQueryBoolOr(r *http.Request, key string, defaultValue bool) bool

func GetQueryInt

func GetQueryInt(r *http.Request, key string) (int, error)

func GetQueryIntOr

func GetQueryIntOr(r *http.Request, key string, defaultValue int) int

func GetQueryParam

func GetQueryParam(r *http.Request, key string) string

func GetQueryParamOr

func GetQueryParamOr(r *http.Request, key string, defaultValue string) string

func HTML

func HTML(w http.ResponseWriter, content string) error

func IsDelete

func IsDelete(r *http.Request) bool

func IsGet

func IsGet(r *http.Request) bool

func IsPatch

func IsPatch(r *http.Request) bool

func IsPost

func IsPost(r *http.Request) bool

func IsPut

func IsPut(r *http.Request) bool

func JSON

func JSON(w http.ResponseWriter, value any) error

func JSONBadRequest

func JSONBadRequest(w http.ResponseWriter, message string) error

func JSONCreated

func JSONCreated(w http.ResponseWriter, value any) error

func JSONError

func JSONError(w http.ResponseWriter, message string, status int) error

func JSONForbidden

func JSONForbidden(w http.ResponseWriter, message string) error

func JSONInternalError

func JSONInternalError(w http.ResponseWriter, message string) error

func JSONNotFound

func JSONNotFound(w http.ResponseWriter, message string) error

func JSONStatus

func JSONStatus(w http.ResponseWriter, value any, status int) error

func JSONUnauthorized

func JSONUnauthorized(w http.ResponseWriter, message string) error

func MethodNotAllowed

func MethodNotAllowed(w http.ResponseWriter, allowed ...string)

func NoContent

func NoContent(w http.ResponseWriter)

func ReadJSON

func ReadJSON(r *http.Request, target any) error

func ReadJSONAndClose

func ReadJSONAndClose(r *http.Request, target any) error

func ReadJSONLimit added in v0.0.8

func ReadJSONLimit(r *http.Request, maxBytes int64, target any) error

func Redirect

func Redirect(w http.ResponseWriter, r *http.Request, url string)

func RedirectPermanent

func RedirectPermanent(w http.ResponseWriter, r *http.Request, url string)

func SafeHTML added in v0.0.8

func SafeHTML(w http.ResponseWriter, content string) error

func SafeRedirect added in v0.0.8

func SafeRedirect(w http.ResponseWriter, r *http.Request, redirectURL string, allowedHosts ...string) error

func SafeURL added in v0.0.5

func SafeURL(tmpl string, pathParams map[string]string, queryParams map[string]string) (string, error)

func SecureHeaders added in v0.0.8

func SecureHeaders(handler http.Handler) http.Handler

func Serve

func Serve(addr string, handler http.Handler) error

func SetSecureHeaders added in v0.0.8

func SetSecureHeaders(w http.ResponseWriter)

func Text

func Text(w http.ResponseWriter, content string) error

func TextStatus

func TextStatus(w http.ResponseWriter, content string, status int) error

func WithCSRF

func WithCSRF(handler http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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