helpers

package
v0.0.0-...-dbce6a0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentTypeValidator

func ContentTypeValidator(response http.ResponseWriter, request *http.Request)

ContentTypeValidator checks for content type existence and check for json validity

func IsNilFixed

func IsNilFixed(i interface{}) bool

func MaxRequestValidator

func MaxRequestValidator(response http.ResponseWriter, request *http.Request) *json.Decoder

MaxRequestValidator uses http.MaxBytesReader to enforce a maximum read of 1MB .

func PostPatchRequestValidator

func PostPatchRequestValidator(response http.ResponseWriter, request *http.Request, err error) bool

PostPatchRequestValidator for creating menus

func SingleJsonValidator

func SingleJsonValidator(response http.ResponseWriter, request *http.Request, err error) bool

SingleJsonValidator calls decode again, using a pointer to an empty anonymous struct as the destination. If the request body only contained a single JSON object this will return an io.EOF error. So if we get anything else, we know that there is additional data in the request body.

Types

This section is empty.

Jump to

Keyboard shortcuts

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