http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAuthHeader error = errors.New("invalid auth header")
)

Functions

func BearerAuth added in v1.0.0

func BearerAuth(r *http.Request) (string, error)

func GetHeaderInt added in v1.0.0

func GetHeaderInt(h http.Header, key string, defaultValue int) int

func GzipMiddlware added in v1.0.0

func GzipMiddlware(next http.Handler) http.Handler

func ReadBoolParam added in v1.0.0

func ReadBoolParam(qs url.Values, key string) bool

ReadBoolParam reads the key from the url query and returns true if the param is equal 'true' otherwise it returns false.

func ReadCSV added in v1.0.0

func ReadCSV(qs url.Values, key string, defaulValue []string) []string

ReadCSV reads a comma seperated string from the given key and returns a slice of the values

func ReadInt added in v1.0.0

func ReadInt(qs url.Values, key string, defaultValue int) int

func ReadString added in v1.0.0

func ReadString(qs url.Values, key string, defaulValue string) string

func ServeFile added in v1.0.0

func ServeFile(w http.ResponseWriter, file File) error

Types

type File added in v1.0.0

type File struct {
	Name        string
	ContentType string
	Reader      io.Reader
}

type GzipResponseWriter added in v1.0.0

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

func NewGzipResponseWriter added in v1.0.0

func NewGzipResponseWriter(w http.ResponseWriter) *GzipResponseWriter

func (*GzipResponseWriter) Flush added in v1.0.0

func (gw *GzipResponseWriter) Flush() error

func (*GzipResponseWriter) Header added in v1.0.0

func (gw *GzipResponseWriter) Header() http.Header

func (*GzipResponseWriter) Write added in v1.0.0

func (gw *GzipResponseWriter) Write(p []byte) (int, error)

func (*GzipResponseWriter) WriteHeader added in v1.0.0

func (gw *GzipResponseWriter) WriteHeader(statusCode int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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