defhandler

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package defhandler provide default handler construction

Index

Constants

This section is empty.

Variables

View Source
var (
	// StatusBadRequest is http.HandlerFunc that always send HTTP status BadRequest
	StatusBadRequest = ResponseCode(http.StatusBadRequest)

	// StatusUnauthorized is http.HandlerFunc that always send HTTP status Unauthorized
	StatusUnauthorized = ResponseCode(http.StatusUnauthorized)

	// StatusForbidden is http.HandlerFunc that always send HTTP status Forbidden
	StatusForbidden = ResponseCode(http.StatusForbidden)

	// StatusNotFound is http.HandlerFunc that always send HTTP status NotFound
	StatusNotFound = ResponseCode(http.StatusNotFound)

	// StatusMethodNotAllowed is http.HandlerFunc that always send HTTP status MethodNotAllowed
	StatusMethodNotAllowed = ResponseCode(http.StatusMethodNotAllowed)

	// StatusUnsupportedMediaType is http.HandlerFunc that always send HTTP status UnsupportedMediaType
	StatusUnsupportedMediaType = ResponseCode(http.StatusUnsupportedMediaType)

	// StatusUnprocessableEntity is http.HandlerFunc that always send HTTP status UnprocessableEntity
	StatusUnprocessableEntity = ResponseCode(http.StatusUnprocessableEntity)

	// StatusNotImplemented is http.HandlerFunc that always send HTTP status NotImplemented
	StatusNotImplemented = ResponseCode(http.StatusNotImplemented)

	// StatusInternalServerError is http.HandlerFunc that always send HTTP status InternalServerError
	StatusInternalServerError = ResponseCode(http.StatusInternalServerError)
)

Functions

func Redirect

func Redirect(url string) http.HandlerFunc

Redirect return http.HandlerFunc that always redirect to url

func ResponseCode

func ResponseCode(code int) http.HandlerFunc

ResponseCode return http.HandlerFunc that always send empty HTTP response with defined status code

func ResponseCodeWithMessage

func ResponseCodeWithMessage(code int, message string) http.HandlerFunc

ResponseCodeWithMessage return http.HandlerFunc that always send HTTP response with defined status code and text/plain message

Types

This section is empty.

Jump to

Keyboard shortcuts

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