handlers

package
v0.58.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationApiKeyHeaderName = "x-api-key"

Variables

This section is empty.

Functions

func DecodeJSONBody added in v0.57.9

func DecodeJSONBody(resp *http.Response, value any) error

func ModifyJSONBody

func ModifyJSONBody(resp *http.Response, value any, fn func() error) error

Types

type Authorization

type Authorization struct {
	Token string
}

func (*Authorization) Auth

func (auth *Authorization) Auth(bearerToken string, ctx echo.Context) (bool, error)

To enhance security, we use token-based authentication to connect to the cache server in order to prevent unauthorized connections from third-party applications. Currently, the cache server only supports `x-api-key` token, the value of which can be any text.

func (*Authorization) MiddlewareFunc

func (auth *Authorization) MiddlewareFunc() echo.MiddlewareFunc

type ReverseProxy

type ReverseProxy struct {
	ServerURL *url.URL

	Rewrite        func(*httputil.ProxyRequest)
	ModifyResponse func(resp *http.Response) error
	ErrorHandler   func(http.ResponseWriter, *http.Request, error)
}

func (*ReverseProxy) NewRequest

func (reverseProxy *ReverseProxy) NewRequest(ctx echo.Context, targetURL *url.URL) error

func (ReverseProxy) WithModifyResponse

func (reverseProxy ReverseProxy) WithModifyResponse(fn func(resp *http.Response) error) *ReverseProxy

func (ReverseProxy) WithRewrite

func (reverseProxy ReverseProxy) WithRewrite(fn func(req *httputil.ProxyRequest)) *ReverseProxy

Jump to

Keyboard shortcuts

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