kapis

package
v0.0.0-...-f45c986 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBadRequest

func HandleBadRequest(response *restful.Response, req *restful.Request, err error)

HandleBadRequest writes http.StatusBadRequest and log error.

func HandleConflict

func HandleConflict(response *restful.Response, req *restful.Request, err error)

HandleConflict writes http.StatusConflict and log error.

func HandleError

func HandleError(request *restful.Request, response *restful.Response, err error)

HandleError detects proper status code, then write it and log error.

func HandleForbidden

func HandleForbidden(response *restful.Response, req *restful.Request, err error)

HandleForbidden writes http.StatusForbidden and log error.

func HandleInternalError

func HandleInternalError(response *restful.Response, req *restful.Request, err error)

HandleInternalError writes http.StatusInternalServerError and log error.

func HandleNotFound

func HandleNotFound(response *restful.Response, req *restful.Request, err error)

HandleNotFound writes http.StatusNotFound and log error.

func HandleTooManyRequests

func HandleTooManyRequests(response *restful.Response, req *restful.Request, err error)

HandleTooManyRequests writes http.StatusTooManyRequests and log error.

func HandleUnauthorized

func HandleUnauthorized(response *restful.Response, req *restful.Request, err error)

HandleUnauthorized writes http.StatusUnauthorized and log error.

func IgnoreEOF

func IgnoreEOF(err error) error

IgnoreEOF returns nil on io.EOF error. All other values that are not io.EOF errors or nil are returned unmodified.

Types

type ResponseWriter

type ResponseWriter struct {
	*restful.Response
}

ResponseWriter is a handler for response.

func (ResponseWriter) WriteEntityOrError

func (handler ResponseWriter) WriteEntityOrError(entity interface{}, err error)

WriteEntityOrError writes entity to the response if no error and writes error message to response if error occurred.

Jump to

Keyboard shortcuts

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