header

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFromContext

func ParseFromContext(ctx context.Context) (http.Header, error)

ParseFromContext almost like FromContext, but this is just a single helper function which is not atttached to ClientHeader's object

Types

type ClientHeader

type ClientHeader struct {
	// contains filtered or unexported fields
}

ClientHeader used by client to convert custom headers to context.Context and send it to server. Server can use this object to parse the header from incoming context request

func New

func New() *ClientHeader

func (*ClientHeader) FromContext

func (ch *ClientHeader) FromContext(ctx context.Context) (*ClientHeader, error)

FromContext use to fetch header's object from context

func (*ClientHeader) Get

func (ch *ClientHeader) Get(key string) (string, error)

Get used to fetch value from header

func (*ClientHeader) Replace

func (ch *ClientHeader) Replace(header http.Header)

Replace use to change internal header's object

func (*ClientHeader) Set

func (ch *ClientHeader) Set(key, val string)

Set new header's key and it's value

func (*ClientHeader) ToContext

func (ch *ClientHeader) ToContext(ctx context.Context) (context.Context, error)

ToContext use to convert internal header and put them all into context

Jump to

Keyboard shortcuts

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