context

package module
v0.0.0-...-2d729b1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2015 License: MIT Imports: 8 Imported by: 1

README

context

Context middleware for gohttp/app

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(r *http.Request, key interface{}) interface{}

Get returns a value stored for a given key in a given request.

func GetRequestID

func GetRequestID(r *http.Request) string

GetRequestID returns id of request.

func New

func New(args ...interface{}) func(http.Handler) http.Handler

New creates context middleware to pass specified map or key-value pairs to next handlers

func RequestID

func RequestID(h http.Handler) http.Handler

RequestID is a middleware that injects a request ID into the context of each request. A request ID is a string of the form "host.example.com/random-0001", where "random" is a base62 random string that uniquely identifies this go process, and where the last number is an atomically incremented request counter.

func Set

func Set(r *http.Request, key, val interface{})

Set stores a value for a given key in a given request.

func SetRequestID

func SetRequestID(r *http.Request, id string)

SetRequestID assigns request id.

Types

This section is empty.

Jump to

Keyboard shortcuts

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