util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) string

BasicAuth create a BasicAuth header value for given user credentials

func BasicAuthMiddleware added in v1.3.0

func BasicAuthMiddleware(includePathPrefix, expectedUsername, expectedPassword string) func(next http.Handler) http.Handler

BasicAuthMiddleware checks whether the BasicAuth header of the request contains the expected username and password

func CreateLogger added in v1.3.0

func CreateLogger(logLevelTxt string) *zap.Logger

CreateLogger creates a logger with the given log level

func JSONAcceptRequest added in v0.0.13

func JSONAcceptRequest(impl func(writer http.ResponseWriter, request *http.Request)) func(http.ResponseWriter, *http.Request)

JSONAcceptRequest checks whether the Accept header of the request is application/json

func JSONContentTypeRequest added in v0.0.13

func JSONContentTypeRequest(impl func(writer http.ResponseWriter, request *http.Request)) func(http.ResponseWriter, *http.Request)

JSONContentTypeRequest checks whether the Content-type header of the request is application/json

func PathParamRequest added in v0.0.13

func PathParamRequest(expectedPathParams []string, impl func(writer http.ResponseWriter, request *http.Request)) func(http.ResponseWriter, *http.Request)

PathParamRequest checks whether the request path contains expected path parameters

func WriteEntity

func WriteEntity(writer http.ResponseWriter, entity interface{})

WriteEntity marshals an entity and writes the output to the http response

Types

This section is empty.

Jump to

Keyboard shortcuts

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