httperror

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP added in v0.0.2

func GetIP(r *http.Request) (string, error)

func NewServer

func NewServer(handler http.Handler, addr string) *http.Server

func RealIPHandler added in v0.0.2

func RealIPHandler(key string) func(next http.Handler) http.Handler

func RequestIDHandler added in v0.0.6

func RequestIDHandler(fieldKey string) func(next http.Handler) http.Handler

Types

type Error

type Error struct {
	Status  int
	Message string
}

func New

func New(status int, message string) Error

func (Error) Error

func (e Error) Error() string

type Handler

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

func (Handler) ServeHTTP

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

type Message added in v0.0.4

type Message struct {
	Body string `json:"body"`
}

type Router

type Router struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter() *Router

func (*Router) Add

func (r *Router) Add(path string, h Handler)

func (*Router) Use added in v0.0.2

func (r *Router) Use(mwf ...middlewareFunc)

Jump to

Keyboard shortcuts

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