headers

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package headers provides middleware that appends headers to requests based on a set of configuration rules that define which routes receive which headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Name  string
	Value string
}

Header represents a single HTTP header, simply a name and value.

type Headers

type Headers struct {
	Next  middleware.Handler
	Rules []Rule
}

Headers is middleware that adds headers to the responses for requests matching a certain path.

func (Headers) ServeHTTP

func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP implements the middleware.Handler interface and serves requests, setting headers on the response according to the configured rules.

type Rule added in v0.6.0

type Rule struct {
	Path    string
	Headers []Header
}

Rule groups a slice of HTTP headers by a URL pattern. TODO: use http.Header type instead?

Jump to

Keyboard shortcuts

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