api

package
v1.97.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeError

func ServeError(log *zap.Logger, w http.ResponseWriter, status int, err error)

ServeError writes JSON error to response output stream.

Types

type Auth

type Auth interface {
	// IsAuthenticated checks if request is performed with all needed authorization credentials.
	IsAuthenticated(ctx context.Context, r *http.Request, isCookieAuth, isKeyAuth bool) (context.Context, error)
	// RemoveAuthCookie indicates to the client that the authentication cookie should be removed.
	RemoveAuthCookie(w http.ResponseWriter)
}

Auth exposes methods to control authentication process for each endpoint.

type HTTPError

type HTTPError struct {
	Status int
	Err    error
}

HTTPError holds http error entity with http status and error itself.

func (HTTPError) Error

func (e HTTPError) Error() string

Error returns http error's string representation.

Jump to

Keyboard shortcuts

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