web

package
Version: v0.0.0-...-555310e Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQValue = 1.0

DefaultQValue is the default qvalue to assign to an encoding if no explicit qvalue is set. This is actually kind of ambiguous in RFC 2616, so hopefully it's correct. The examples seem to indicate that it is.

Variables

This section is empty.

Functions

func GzipHandler

func GzipHandler(h http.Handler) http.Handler

GzipHandler wraps an HTTP handler, to transparently gzip the response body if the client supports it (via the Accept-Encoding header).

func Start

func Start(runSilent bool)

Start listening for and responding to HTTP requests via the web server. Panics if unable to start.

Types

type GzipResponseWriter

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

GzipResponseWriter provides an http.ResponseWriter interface, which gzips bytes before writing them to the underlying response. This doesn't set the Content-Encoding header, nor close the writers, so don't forget to do that.

func (GzipResponseWriter) Flush

func (w GzipResponseWriter) Flush()

Flush flushes the underlying *gzip.Writer and then the underlying http.ResponseWriter if it is an http.Flusher. This makes GzipResponseWriter an http.Flusher.

func (GzipResponseWriter) Write

func (w GzipResponseWriter) Write(b []byte) (int, error)

Write appends data to the gzip writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL