httputils

package
v0.0.0-...-1643d90 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: UPL-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleError

func HandleError(w http.ResponseWriter, err error)

func SendBadRequestResponse

func SendBadRequestResponse(w http.ResponseWriter, object interface{})

func SendBasicAtzErrorResponse

func SendBasicAtzErrorResponse(w http.ResponseWriter, realm string)

func SendBearerAtzErrorResponse

func SendBearerAtzErrorResponse(w http.ResponseWriter, realm string, err string, errDesc string)

func SendCreatedResponse

func SendCreatedResponse(w http.ResponseWriter, object interface{})

func SendEmptyListResponse

func SendEmptyListResponse(w http.ResponseWriter)

func SendInternalErrorResponse

func SendInternalErrorResponse(w http.ResponseWriter, object interface{})

func SendOKResponse

func SendOKResponse(w http.ResponseWriter, object interface{})

func SendPageNotFoundResponse

func SendPageNotFoundResponse(w http.ResponseWriter)

func SendResponse

func SendResponse(w http.ResponseWriter, statusCode int, object interface{})

func VerifyContentType

func VerifyContentType(w http.ResponseWriter, r *http.Request, expectedContentTypes []string) bool

VerifyContentType reads content type from HTTP header, if the content type can not be found in expectedContentTypes, write response with status 415 Unsupported Media Type and returns false.

Types

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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