httputil

package
v0.0.0-...-43bca8b Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(message string) error

func Forbidden

func Forbidden(message string) error

func JSON

func JSON(val any) jsonValue

func Respond

func Respond(resp ToResponse, w http.ResponseWriter, r *http.Request)

func Route

func Route(f func(w http.ResponseWriter, r *http.Request) ToResponse) http.Handler

func Unauthorized

func Unauthorized() error

Types

type HttpError

type HttpError struct {
	Message    string
	StatusCode int
}

func (HttpError) Error

func (h HttpError) Error() string

func (HttpError) ServeHTTP

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

type ToResponse

type ToResponse any

Jump to

Keyboard shortcuts

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