utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DummyRoute

func DummyRoute(w http.ResponseWriter, r *http.Request)

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, message string, statusCode int, errorCodes ...int)

func ExtractBearerToken

func ExtractBearerToken(authHeader string) string

ExtractBearerToken extracts the token from the Authorization header. The header should be in the format: "Bearer <token>".

func GetClientIP

func GetClientIP(r *http.Request) string

func HashSHA256 added in v1.0.0

func HashSHA256(s string) string

func IsValidRedirectURI

func IsValidRedirectURI(uri string) bool

IsValidRedirectURI checks that the given URI is a syntactically valid URL with a scheme and host. Per-client redirect URI allowlist validation is handled separately at the client level.

func Ptr added in v1.3.2

func Ptr[T any](v T) *T

Ptr returns a pointer to the given value

func SuccessResponse

func SuccessResponse[T any](w http.ResponseWriter, data T, statusCodes ...int)

func WriteApiResponse

func WriteApiResponse(w http.ResponseWriter, data any, statusCode int)

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, statusCode int, errorType, errorDescription string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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