session

package
v2.0.0-beta.2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package session provides contextual information about a single HTTP/S connection and its associated requests and responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

func FromContext(ctx *Context) *Context

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

func (ctx *Context) Get(key string) (interface{}, bool)

Get takes key and returns the associated value from the context.

func (*Context) GetSession

func (ctx *Context) GetSession() *Session

GetSession returns the session for the context.

func (*Context) Set

func (ctx *Context) Set(key string, val interface{})

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

func (ctx *Context) SkippingRoundTrip() bool

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

func (s *Session) Get(key string) (interface{}, bool)

Get takes key and returns the associated value from the session.

func (*Session) ID

func (s *Session) ID() string

ID returns the session ID.

func (*Session) IsSecure

func (s *Session) IsSecure() bool

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

func (s *Session) Set(key string, val interface{})

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

func (s *Session) SetID(id string)

SetID sets the ID for the session. The ID will be persisted across multiple requests and responses.

Jump to

Keyboard shortcuts

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