handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentTypeHandler added in v1.0.0

func ContentTypeHandler(ctx *context.Context, h http.Handler) http.Handler

ContentTypeHandler will set the correct content type for the HTTP response

func DelayHandler

func DelayHandler(ctx *context.Context, h http.Handler) http.Handler

DelayHandler returns a handler function that introduces a delay in responding to the HTTP request

func EncodeAsJSON

func EncodeAsJSON(r *http.Request, prettyPrint bool) ([]byte, error)

func FailureSimulationHandler

func FailureSimulationHandler(ctx *context.Context, h http.Handler) http.Handler

FailureSimulationHandler returns a handler function that simulates a transient HTTP failure scenario, e.g. a series of failure response codes followed by a series of successful HTTP status codes

func JSONRequestLoggingHandler

func JSONRequestLoggingHandler(ctx *context.Context, h http.Handler) http.Handler

JSONLoggingHandler returns a handler function that logs the incoming HTTP request in a compact or formatted JSON format

func ProxyHandler

func ProxyHandler(ctx *context.Context, h http.Handler) http.Handler

ProxyHandler returns a handler function that forwards the incoming HTTP request to an upstream HTTP service

func RawRequestLoggingHandler

func RawRequestLoggingHandler(ctx *context.Context, h http.Handler) http.Handler

RawRequestLoggingHandler returns a handler function that logs the incoming HTTP request in plain text format

func ResponseCodeHandler

func ResponseCodeHandler(ctx *context.Context, h http.Handler) http.Handler

ResponseCodeHandler returns a handler function that returns the specified HTTP status code

Types

This section is empty.

Jump to

Keyboard shortcuts

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