handlers

package
v0.0.0-...-e26ef75 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Files

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

Files is a handler for reading and writing files

func NewFiles

func NewFiles(s files.Storage, maxSize int64, l hclog.Logger) *Files

NewFiles creates a new File handler

func (*Files) SaveFileREST

func (f *Files) SaveFileREST(rw http.ResponseWriter, r *http.Request)

SaveFileREST saves the contents of the request to a file from the request

type Middleware

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

func NewMiddleware

func NewMiddleware(maxContentLength int64, logger hclog.Logger) *Middleware

NewMiddleware creates a new middleware handlers

func (*Middleware) CheckContentLengthMiddleware

func (mw *Middleware) CheckContentLengthMiddleware(next http.Handler) http.Handler

CheckContentLengthMiddleware ensures that the content length is not greater than our allowed max. This can not be 100% depended on as Content-Length might be reported incorrectly however it is a fast first pass check.

func (*Middleware) GZipResponseMiddleware

func (mw *Middleware) GZipResponseMiddleware(next http.Handler) http.Handler

GZipResponseMiddleware detects if the client can handle zipped content and if so returns the response in GZipped format

type WrappedResponseWriter

type WrappedResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

WrappedResponseWriter wrapps the default http.ResponseWriter in a GZip stream

func NewWrappedResponseWriter

func NewWrappedResponseWriter(rw http.ResponseWriter) *WrappedResponseWriter

NewWrappedResponseWriter returns a new wrapped response writer

func (*WrappedResponseWriter) Flush

func (wr *WrappedResponseWriter) Flush()

Flush implements the Flusher interface which allows ResponseWriters

func (*WrappedResponseWriter) Write

func (wr *WrappedResponseWriter) Write(d []byte) (int, error)

Write overrides the http.ResponseWriter Write method and ensures that data is written throught he gzip writer not direct to the output stream

Jump to

Keyboard shortcuts

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