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: 11 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

func (*Files) SaveMultipart

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

SaveMultipart handles multipart files

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 {
	// 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 http.ResponseWriter Flush method

func (*WrappedResponseWriter) Header

func (wr *WrappedResponseWriter) Header() http.Header

Header implements the http.ResponseWriter Header method

func (*WrappedResponseWriter) Write

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

Write implements the http.ResponseWriter Write method

func (*WrappedResponseWriter) WriteHeader

func (wr *WrappedResponseWriter) WriteHeader(statusCode int)

WriteHeader implements the http.ResponseWriter WriteHeader method

Jump to

Keyboard shortcuts

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