Documentation ¶
Index ¶
- Variables
- func ConvertRequestToHttpRequest(req *Request) (r *http.Request, err error)
- func ConvertResponseWriterToHttpResponseWriter(writer ResponseWriter) (w http.ResponseWriter)
- func FastHttpTransportHandlerAdaptor(h Handler) fasthttp.RequestHandler
- func HttpTransportHandlerAdaptor(h Handler, maxRequestBody int) http.Handler
- func Register(transport Transport)
- type Client
- type CorsConfig
- type Dialer
- type FastHttpClientOptions
- type FastHttpTransportOptions
- type Handler
- type HandlerFunc
- type Header
- func (h Header) Add(key, value string)
- func (h Header) Authorization() string
- func (h Header) ClearSiteData(scopes ...string)
- func (h Header) Clone() Header
- func (h Header) Connection() string
- func (h Header) Del(key string)
- func (h Header) Get(key string) string
- func (h Header) IsConnectionClosed() bool
- func (h Header) Set(key, value string)
- func (h Header) SetConnectionClose()
- func (h Header) Upgrade() string
- func (h Header) Values(key string) []string
- type Options
- type Request
- func (r *Request) Body() []byte
- func (r *Request) Context() context.Context
- func (r *Request) Header() Header
- func (r *Request) Host() []byte
- func (r *Request) IsGet() bool
- func (r *Request) IsPost() bool
- func (r *Request) IsTLS() bool
- func (r *Request) Method() []byte
- func (r *Request) Param(name string) []byte
- func (r *Request) Params() RequestParams
- func (r *Request) Path() []byte
- func (r *Request) Proto() []byte
- func (r *Request) RemoteAddr() []byte
- func (r *Request) SetBody(body []byte)
- func (r *Request) SetHost(host []byte)
- func (r *Request) SetProto(proto []byte)
- func (r *Request) TLSConnectionState() *tls.ConnectionState
- func (r *Request) URL() ([]byte, error)
- func (r *Request) UseTLS()
- func (r *Request) WithContext(ctx context.Context) *Request
- type RequestParams
- type Response
- type ResponseWriter
- type Transport
- type WriteBuffer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MethodGET = []byte(http.MethodGet) MethodPost = []byte(http.MethodPost) )
View Source
var (
ErrTooBigRequestBody = errors.Warning("fns: request body is too big")
)
Functions ¶
func ConvertRequestToHttpRequest ¶ added in v1.0.14
func ConvertResponseWriterToHttpResponseWriter ¶ added in v1.0.14
func ConvertResponseWriterToHttpResponseWriter(writer ResponseWriter) (w http.ResponseWriter)
func FastHttpTransportHandlerAdaptor ¶
func FastHttpTransportHandlerAdaptor(h Handler) fasthttp.RequestHandler
Types ¶
type CorsConfig ¶
type CorsConfig struct { AllowedOrigins []string `json:"allowedOrigins"` AllowedHeaders []string `json:"allowedHeaders"` ExposedHeaders []string `json:"exposedHeaders"` AllowCredentials bool `json:"allowCredentials"` MaxAge int `json:"maxAge"` AllowPrivateNetwork bool `json:"allowPrivateNetwork"` }
func (*CorsConfig) Handler ¶
func (config *CorsConfig) Handler(handler Handler) Handler
func (*CorsConfig) TryFillAllowedHeaders ¶
func (config *CorsConfig) TryFillAllowedHeaders(headers []string)
func (*CorsConfig) TryFillExposedHeaders ¶
func (config *CorsConfig) TryFillExposedHeaders(headers []string)
type FastHttpClientOptions ¶ added in v1.0.12
type FastHttpClientOptions struct { DialDualStack bool `json:"dialDualStack"` MaxConnsPerHost int `json:"maxConnsPerHost"` MaxIdleConnDuration string `json:"maxIdleConnDuration"` MaxConnDuration string `json:"maxConnDuration"` MaxIdemponentCallAttempts int `json:"maxIdemponentCallAttempts"` ReadBufferSize string `json:"readBufferSize"` ReadTimeout string `json:"readTimeout"` WriteBufferSize string `json:"writeBufferSize"` WriteTimeout string `json:"writeTimeout"` MaxResponseBodySize string `json:"maxResponseBodySize"` MaxConnWaitTimeout string `json:"maxConnWaitTimeout"` }
type FastHttpTransportOptions ¶ added in v1.0.12
type FastHttpTransportOptions struct { ReadBufferSize string `json:"readBufferSize"` ReadTimeout string `json:"readTimeout"` WriteBufferSize string `json:"writeBufferSize"` WriteTimeout string `json:"writeTimeout"` MaxIdleWorkerDuration string `json:"maxIdleWorkerDuration"` TCPKeepalive bool `json:"tcpKeepalive"` TCPKeepalivePeriod string `json:"tcpKeepalivePeriod"` MaxRequestBodySize string `json:"maxRequestBodySize"` ReduceMemoryUsage bool `json:"reduceMemoryUsage"` MaxRequestsPerConn int `json:"maxRequestsPerConn"` KeepHijackedConns bool `json:"keepHijackedConns"` StreamRequestBody bool `json:"streamRequestBody"` Prefork bool `json:"prefork"` Client FastHttpClientOptions `json:"client"` }
type Handler ¶
type Handler interface {
Handle(w ResponseWriter, r *Request)
}
type HandlerFunc ¶
type HandlerFunc func(ResponseWriter, *Request)
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(w ResponseWriter, r *Request)
type Header ¶
func (Header) Authorization ¶
func (Header) ClearSiteData ¶ added in v1.0.22
func (Header) Connection ¶
func (Header) IsConnectionClosed ¶
func (Header) SetConnectionClose ¶
func (h Header) SetConnectionClose()
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewUnsafeRequest ¶
func (*Request) Params ¶
func (r *Request) Params() RequestParams
func (*Request) RemoteAddr ¶
func (*Request) TLSConnectionState ¶ added in v1.0.14
func (r *Request) TLSConnectionState() *tls.ConnectionState
type RequestParams ¶
func (RequestParams) Add ¶
func (params RequestParams) Add(name []byte, value []byte)
func (RequestParams) Del ¶
func (params RequestParams) Del(name []byte)
func (RequestParams) Get ¶
func (params RequestParams) Get(name []byte) []byte
func (RequestParams) Len ¶
func (params RequestParams) Len() int
func (RequestParams) String ¶
func (params RequestParams) String() string
type ResponseWriter ¶
type Transport ¶
type Transport interface { Name() (name string) Build(options Options) (err error) Dialer ListenAndServe() (err error) io.Closer }
func Registered ¶
type WriteBuffer ¶
Click to show internal directories.
Click to hide internal directories.