header

package
Version: v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 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.

Source Files

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