middleware

package
v0.0.0-...-fe10e82 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessRequest

func ProcessRequest(handler ProcessedHandlerFunc) http.HandlerFunc

ProcessRequest reads in the json body of the request if it exists

Types

type ProcessedHandlerFunc

type ProcessedHandlerFunc func(http.ResponseWriter, *ProcessedRequest)

ProcessedHandlerFunc function type for handlers

func Cache

Cache implements a memcache layer for storing processed images

func Validator

func Validator(handler ProcessedHandlerFunc, schemaPath string) ProcessedHandlerFunc

Validator performs a json schema validation on an request body

type ProcessedRequest

type ProcessedRequest struct {
	RawRequest *http.Request

	// TODO: Explore a better solution for this, ideally we would pass an
	// unmarshalled object here so the handler didn't have to unmarshal itself
	JSON []byte
}

ProcessedRequest adds the validated json object to the incoming request body

Jump to

Keyboard shortcuts

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