utils

package
v0.0.0-...-ef901e4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBearerToken

func GetBearerToken(ctx context.Context, args router.MiddlewareArgs) string

GetBearerToken returns "Authorization: Bearer ..." value. If not found, returns "".

func SendError

func SendError(ctx context.Context, w http.ResponseWriter, status int, message string, err error)

SendError send arbital error response with given HTTP status.

func SendInternalServerError

func SendInternalServerError(ctx context.Context, w http.ResponseWriter, err error)

SendInternalServerError send 500

func SendInvalidParameter

func SendInvalidParameter(ctx context.Context, w http.ResponseWriter, name string, err error)

SendInvalidParameter send 400

func SendJSON

func SendJSON(ctx context.Context, w http.ResponseWriter, status int, data interface{})

SendJSON send JSON response body

func SendJwtUnsupportedError

func SendJwtUnsupportedError(ctx context.Context, w http.ResponseWriter)

SendJwtUnsupportedError send 501

func SendMissingParameter

func SendMissingParameter(ctx context.Context, w http.ResponseWriter, name string)

SendMissingParameter send 400

func SendNoContent

func SendNoContent(ctx context.Context, w http.ResponseWriter)

SendNoContent sends 204 No Content

func SendPubSubUnsupportedError

func SendPubSubUnsupportedError(ctx context.Context, w http.ResponseWriter)

SendPubSubUnsupportedError send 501

Types

This section is empty.

Jump to

Keyboard shortcuts

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