header

package
Version: v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package header 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  httpserver.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 httpserver.Handler interface and serves requests, setting headers on the response according to the configured rules.

type Rule

type Rule struct {
	Path    string
	Headers []Header
}

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

Source Files

Jump to

Keyboard shortcuts

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