headers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package headers contains middlewares for manipulating headers on request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(header, value string) c.Middleware

Add adds provided header to ongoing request.

func Del

func Del(header string) c.Middleware

Del removes provided header from ongoing request.

func FromContext

func FromContext(key interface{}) c.Middleware

FromContext adds header to request that is defined in context with provided key.

func Method

func Method(method string) c.Middleware

Method sets request method to ongoing request.

func Set

func Set(header, value string) c.Middleware

Set sets provided header to ongoing request.

func SetMap

func SetMap(headers map[string]string) c.Middleware

SetMap sets multiple headers provided in a map.

func ToContext

func ToContext(ctx context.Context, key interface{}, header string, values ...string) context.Context

ToContext adds headers to context that can be used with FromContext middleware. This is intended to be used for single header (but possibly multiple values). If you need to set multiple headers, use ToContextList.

func ToContextList

func ToContextList(ctx context.Context, key interface{}, h []Header) context.Context

ToContextList adds list of headers to context that can be used with FromContext middleware.

Types

type Header struct {
	Key   string
	Value []string
}

Header holds information about what headers to add from context for FromContext middleware.

Jump to

Keyboard shortcuts

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