handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HeaderContentType = "Content-Type"

	ContentTypeText = "text/plain"
	ContentTypeJson = "application/json"
)

Variables

This section is empty.

Functions

func MethodNotAllowedHandler

func MethodNotAllowedHandler(w http.ResponseWriter, _r *http.Request)

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, _r *http.Request)

func SendBadGateway

func SendBadGateway(rw http.ResponseWriter, details map[string]string)

502 Bad Gateway

func SendBadRequest

func SendBadRequest(rw http.ResponseWriter, details map[string]string)

400 Bad Request

func SendConflict

func SendConflict(rw http.ResponseWriter, details map[string]string)

409 Conflict

func SendExpectationFailed

func SendExpectationFailed(rw http.ResponseWriter, details map[string]string)

417 Expectation Failed

func SendForbidden

func SendForbidden(rw http.ResponseWriter, details map[string]string)

403 Forbidden

func SendGatewayTimeout

func SendGatewayTimeout(rw http.ResponseWriter, details map[string]string)

504 Gateway Timeout

func SendGone

func SendGone(rw http.ResponseWriter, details map[string]string)

410 Gone

func SendHTTPVersionNotSupported

func SendHTTPVersionNotSupported(rw http.ResponseWriter, details map[string]string)

505 HTTP Version Not Supported

func SendInternalServerError

func SendInternalServerError(rw http.ResponseWriter, details map[string]string)

500 Internal Server Error

func SendJson

func SendJson(rw http.ResponseWriter, response []byte)

func SendLengthRequired

func SendLengthRequired(rw http.ResponseWriter, details map[string]string)

411 Length Required

func SendMethodNotAllowed

func SendMethodNotAllowed(rw http.ResponseWriter, details map[string]string)

405 Method Not Allowed

func SendNotAcceptable

func SendNotAcceptable(rw http.ResponseWriter, details map[string]string)

406 Not Acceptable

func SendNotFound

func SendNotFound(rw http.ResponseWriter, details map[string]string)

404 Not Found

func SendNotImplemented

func SendNotImplemented(rw http.ResponseWriter, details map[string]string)

501 Not Implemented

func SendPayloadTooLarge

func SendPayloadTooLarge(rw http.ResponseWriter, details map[string]string)

413 Payload Too Large

func SendPreconditionFailed

func SendPreconditionFailed(rw http.ResponseWriter, details map[string]string)

412 Precondition Failed

func SendRangeNotSatisfiable

func SendRangeNotSatisfiable(rw http.ResponseWriter, details map[string]string)

416 Range Not Satisfiable

func SendRequestTimeout

func SendRequestTimeout(rw http.ResponseWriter, details map[string]string)

408 Request Timeout

func SendServiceUnavailable

func SendServiceUnavailable(rw http.ResponseWriter, details map[string]string)

503 Service Unavailable

func SendText

func SendText(rw http.ResponseWriter, response string)

func SendTooManyRequests

func SendTooManyRequests(rw http.ResponseWriter, details map[string]string)

429 Too Many Requests

func SendURITooLong

func SendURITooLong(rw http.ResponseWriter, details map[string]string)

414 URI Too Long

func SendUnauthorized

func SendUnauthorized(rw http.ResponseWriter, details map[string]string)

401 Unauthorized

func SendUnprocessableEntity

func SendUnprocessableEntity(rw http.ResponseWriter, details map[string]string)

422 Unprocessable Entity

func SendUnsupportedMediaType

func SendUnsupportedMediaType(rw http.ResponseWriter, details map[string]string)

415 Unsupported Media Type

Types

type HttpError

type HttpError struct {
	Title   string            `json:"title"`
	Status  int               `json:"status"`
	Details map[string]string `json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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