header

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 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 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 http.Header
}

Rule groups a slice of HTTP headers by a URL pattern.

Jump to

Keyboard shortcuts

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