Version: v0.0.0-...-c891ed9 Latest Latest

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

Go to latest
Published: Oct 5, 2019 License: Apache-2.0 Imports: 8 Imported by: 0




This section is empty.


View Source
var (
	// DefaultTimeoutHandler holds the message that will be thrown when processing time cross the timeout.
	DefaultTimeoutHandler = http.HandlerFunc(
		func(res http.ResponseWriter, req *http.Request) {
			res.Write([]byte("Service timeout"))


func GzipHandler

func GzipHandler(next http.Handler) http.Handler

GzipHandler will help in compressing the response served as per the call made to neuron.

func JsonHandler

func JsonHandler(h http.Handler) http.Handler

JsonHandler will set the header with content-type json.

func TimeoutHandler

func TimeoutHandler(next http.Handler) http.Handler

TimeoutHandler will be responsible for timing out the request if it takes annoying time to serve.


type GzipMiddleware

type GzipMiddleware struct {
	Next http.Handler

GzipMiddleware holds the http handler which has to be compressed.

func (*GzipMiddleware) ServeHTTP

func (gm *GzipMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Login

type Login struct {
	Logpath io.Writer

Login will hold the writer and will be used while writing logs.

func (*Login) Logger

func (loger *Login) Logger(next http.Handler) http.Handler

Logger will log all the request served by the neuron through API.

type TimeoutMiddleware

type TimeoutMiddleware struct {
	Next http.Handler

TimeoutMiddleware holds the http handler for which timeout has to be set.

func (TimeoutMiddleware) ServeHTTP

func (tm TimeoutMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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