params

package
v0.0.0-...-a4359f9 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSize          = fmt.Errorf("Invalid size")
	ErrInvalidFileExtension = fmt.Errorf("Invalid file extension")
)

Errors

Functions

func BuildQuery

func BuildQuery(v url.Values) string

BuildQuery builds a query parameter string for the given values It differs from the stdlib url.Values.Encode in that it encodes query parameters with an empty value as "?key" instead of "?key="

func HMAC

func HMAC(h *hmac.HMAC, path string, query url.Values) (string, error)

HMAC generates and appends an HMAC to a URL path + query params

func ValidateHMAC

func ValidateHMAC(h *hmac.HMAC, r *http.Request) (bool, error)

ValidateHMAC validates the URL path/query params, given an hmac in a query parameter named hmac

Types

type Params

type Params struct {
	Width      int
	Height     int
	Blur       bool
	BlurAmount int
	Grayscale  bool
	Extension  string
}

Params contains all the parameters for a request

func GetParams

func GetParams(r *http.Request) (*Params, error)

GetParams parses and returns all the path and query parameters

Jump to

Keyboard shortcuts

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