httputil

package
Version: v0.0.0-...-95bd64c Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorJSON

func ErrorJSON(w io.Writer, err error) error

ErrorJSON writes the given error JSON-formatted to w.

func GetQueryParams

func GetQueryParams(r *http.Request) url.Values

GetQueryParams calls r.ParseForm and returns r.Form.

func NewDeadlineClient

func NewDeadlineClient(timeout time.Duration) *http.Client

NewDeadlineClient returns a new http.Client which will time out long running requests.

func RespondJSON

func RespondJSON(w io.Writer, val promql.Value) error

RespondJSON converts the given data value to JSON and writes it to w.

Types

type CompressionHandler

type CompressionHandler struct {
	Handler http.Handler
}

CompressionHandler is a wrapper around http.Handler which adds suitable response compression based on the client's Accept-Encoding headers.

func (CompressionHandler) ServeHTTP

func (c CompressionHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)

ServeHTTP adds compression to the original http.Handler's ServeHTTP() method.

Jump to

Keyboard shortcuts

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