http

package
v3.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRoundTripper

func NewRoundTripper(opts ...Option) http.RoundTripper

NewRoundTripper creates new http RoundTripper

func RequestToContext

func RequestToContext(r *http.Request) context.Context

RequestToContext puts the `Authorization` header bearer token into context so calls to services will be authorized.

func Write

func Write(w http.ResponseWriter, contentType string, status int, body string)

Write sets the status and body on a http ResponseWriter

func WriteBadRequestError

func WriteBadRequestError(w http.ResponseWriter, err error)

WriteBadRequestError sets a 400 status code

func WriteInternalServerError

func WriteInternalServerError(w http.ResponseWriter, err error)

WriteInternalServerError sets a 500 status code

Types

type Option

type Option func(*Options)

Option func

func WithRouter

func WithRouter(r router.Router) Option

WithRouter sets the router.Router option

type Options

type Options struct {
	Router router.Router
}

Options struct

type Trie added in v3.7.5

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

Tree is a trie tree.

func NewTrie added in v3.7.5

func NewTrie() *Trie

NewTree creates a new trie tree.

func (*Trie) Insert added in v3.7.5

func (t *Trie) Insert(methods []string, path string, handler interface{})

Insert inserts a route definition to tree.

func (*Trie) Search added in v3.7.5

func (t *Trie) Search(method string, path string, opts ...TrieOption) (interface{}, map[string]string, bool)

Search searches a path from a tree.

type TrieOption added in v3.7.6

type TrieOption func(*TrieOptions)

TrieOption func signature

func IgnoreCase added in v3.7.6

func IgnoreCase(b bool) TrieOption

IgnoreCase says that search must be case insensitive

type TrieOptions added in v3.7.6

type TrieOptions struct {
	IgnoreCase bool
}

TrieOptions contains search options

Jump to

Keyboard shortcuts

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