package session
import "github.com/google/martian/session"
Package session provides contextual information about a single HTTP/S connection and its associated requests and responses.
Index ¶
- type Context
- func FromContext(ctx *Context) *Context
- func (ctx *Context) Get(key string) (interface{}, bool)
- func (ctx *Context) GetSession() *Session
- func (ctx *Context) Set(key string, val interface{})
- func (ctx *Context) SkipRoundTrip()
- func (ctx *Context) SkippingRoundTrip() bool
- type Session
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context provides information and storage for a single request/response pair. Contexts are linked to shared session that is used for multiple requests on a single connection.
func FromContext ¶
FromContext builds a new context from an existing context. The new context shares the same session as the passed context, but does not inherit any of its request specific values. If ctx is nil, a new context and session are created.
func (*Context) Get ¶
Get takes key and returns the associated value from the context.
func (*Context) GetSession ¶
GetSession returns the session for the context.
func (*Context) Set ¶
Set takes a key and associates it with val in the context. The value is persisted for the duration of the request and is removed on the following request.
func (*Context) SkipRoundTrip ¶
func (ctx *Context) SkipRoundTrip()
SkipRoundTrip skips the round trip for the current request.
func (*Context) SkippingRoundTrip ¶
SkippingRoundTrip returns whether the current round trip will be skipped.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session provides information and storage about a connection.
func (*Session) Get ¶
Get takes key and returns the associated value from the session.
func (*Session) ID ¶
ID returns the session ID.
func (*Session) IsSecure ¶
IsSecure returns whether the current session is from a secure connection, such as when receiving requests from a TLS connection that has been MITM'd.
func (*Session) MarkSecure ¶
func (s *Session) MarkSecure()
MarkSecure marks the session as secure.
func (*Session) Set ¶
Set takes a key and associates it with val in the session. The value is persisted for the entire session across multiple requests and responses.
func (*Session) SetID ¶
SetID sets the ID for the session. The ID will be persisted across multiple requests and responses.
Source Files ¶
- Version
- v2.0.0-beta+incompatible
- Published
- Aug 14, 2015
- Platform
- windows/amd64
- Imports
- 1 packages
- Last checked
- 3 hours ago –
Tools for package owners.