fasthttp

package module
v0.0.0-...-09b2620 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: BSD-3-Clause Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MethodGet      = "GET"     // RFC 7231, 4.3.1
	MethodHead     = "HEAD"    // RFC 7231, 4.3.2
	MethodPost     = "POST"    // RFC 7231, 4.3.3
	MethodPut      = "PUT"     // RFC 7231, 4.3.4
	MethodPatch    = "PATCH"   // RFC 5789
	MethodDelete   = "DELETE"  // RFC 7231, 4.3.5
	MethodConnect  = "CONNECT" // RFC 7231, 4.3.6
	MethodOptions  = "OPTIONS" // RFC 7231, 4.3.7
	MethodTrace    = "TRACE"   // RFC 7231, 4.3.8
	MethodWildcard = "*"
)

HTTP methods were copied from net/http.

Variables

This section is empty.

Functions

func MustNew

func MustNew(opts ...Option) kit.Gateway

func New

func New(opts ...Option) (kit.Gateway, error)

Types

type CORSConfig

type CORSConfig struct {
	AllowedHeaders []string
	AllowedMethods []string
	AllowedOrigins []string
	ExposedHeaders []string
}

type DecoderFunc

type DecoderFunc = func(bag Params, data []byte) (kit.Message, error)

type Option

type Option func(b *bundle)

func Listen

func Listen(addr string) Option

func WithBufferSize

func WithBufferSize(read, write int) Option

func WithCORS

func WithCORS(cfg CORSConfig) Option

func WithLogger

func WithLogger(l kit.Logger) Option

func WithPredicateKey

func WithPredicateKey(key string) Option

func WithServerName

func WithServerName(name string) Option

func WithWebsocketEndpoint

func WithWebsocketEndpoint(endpoint string) Option

type Params

type Params = httpmux.Params

type Selector

type Selector struct {
	Method    string
	Path      string
	Predicate string
	Decoder   DecoderFunc
	Encoding  kit.Encoding
}

Selector implements kit.RouteSelector and also kit.RPCRouteSelector and kit.RESTRouteSelector

func DELETE

func DELETE(path string) Selector

DELETE a shortcut for REST(http.MethodDelete, path)

func GET

func GET(path string) Selector

GET a shortcut for REST(http.MethodGet, path)

func PATCH

func PATCH(path string) Selector

PATCH a shortcut for REST(http.MethodPatch, path)

func POST

func POST(path string) Selector

POST a shortcut for REST(http.MethodPost, path)

func PUT

func PUT(path string) Selector

PUT a shortcut for REST(http.MethodPut, path)

func REST

func REST(method, path string) Selector

REST returns a Selector which acts on http requests.

func RPC

func RPC(predicate string) Selector

RPC returns a Selector which acts on websocket requests

func (Selector) GetEncoding

func (r Selector) GetEncoding() kit.Encoding

func (Selector) GetMethod

func (r Selector) GetMethod() string

func (Selector) GetPath

func (r Selector) GetPath() string

func (Selector) GetPredicate

func (r Selector) GetPredicate() string

func (Selector) Query

func (r Selector) Query(q string) interface{}

func (*Selector) SetEncoding

func (r *Selector) SetEncoding(enc kit.Encoding) *Selector

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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