server

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorsHandler

func CorsHandler(allowOrigins []string) mux.MiddlewareFunc

CorsHandler sets the cors settings on api endpoints

func NormalizeQueryValues

func NormalizeQueryValues(queryParams url.Values)

NormalizeQueryValues replaces comma-separated values with individual values

func NormalizeQueryValuesHandler

func NormalizeQueryValuesHandler(next http.Handler) http.Handler

NormalizeQueryValuesHandler normalizes an input query of "key=value1,value2,value3" to "key=value1&key=value2&key=value3"

Types

type DecodeError

type DecodeError struct {
	// contains filtered or unexported fields
}

DecodeError represents an error resulting from trying to decode an HTTP request. It tracks the full field name for which decoding failed.

func NewDecodeError

func NewDecodeError(err error, field string) *DecodeError

NewDecodeError wraps an error (either the initial decoding error or another DecodeError). The current field that failed decoding must be passed in.

func (*DecodeError) Error

func (e *DecodeError) Error() string

Error returns the formatted error message which contains the full field name and the actual decoding error.

type IndexedVerificationFailure

type IndexedVerificationFailure struct {
	Index   int    `json:"index"`
	Message string `json:"message"`
}

IndexedVerificationFailure represents an issue when verifying a single indexed object e.g. an item in an array.

type IndexedVerificationFailureError

type IndexedVerificationFailureError struct {
	Message  string                        `json:"message"`
	Code     int                           `json:"code"`
	Failures []*IndexedVerificationFailure `json:"failures"`
}

IndexedVerificationFailureError wraps a collection of verification failures.

func (*IndexedVerificationFailureError) StatusCode

func (e *IndexedVerificationFailureError) StatusCode() int

Jump to

Keyboard shortcuts

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