Help us shape the future of Go! Take the 2026 Go Developer Survey

headers

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package headers sets response headers and selects middleware by request header.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(configs ...Config) zinc.Middleware

New sets the configured response headers, then applies the first matching header route.

Types

type Config

type Config struct {
	// Set holds response headers written before downstream handlers run.
	Set map[string]string
	// Routes are checked in order. The first match runs in place of the rest
	// of the chain; that middleware decides whether to call Next.
	Routes []Route
}

Config lists the response headers to set and the header routes to apply.

type Route

type Route struct {
	Header     string
	Value      string
	Middleware zinc.Middleware
}

Route runs Middleware when the request carries Header, and its value is Value when Value is not empty.

Jump to

Keyboard shortcuts

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