fasthttp

package
v2.31.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 17

Documentation

Index

Constants

View Source
const Name = `fasthttp`

Variables

View Source
var ErrAlreadyCommitted = errors.New(`response already committed`)

Functions

This section is empty.

Types

type Request

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

func NewRequest

func NewRequest(c *fasthttp.RequestCtx) *Request

func (*Request) BasicAuth

func (r *Request) BasicAuth() (username, password string, ok bool)

BasicAuth returns the username and password provided in the request's Authorization header, if the request uses HTTP Basic Authentication. See RFC 2617, Section 2.

func (*Request) Body

func (r *Request) Body() io.ReadCloser

func (*Request) Context added in v1.6.0

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

func (*Request) Cookie

func (r *Request) Cookie(key string) string

func (*Request) Form

func (r *Request) Form() engine.URLValuer

func (*Request) FormFile

func (r *Request) FormFile(key string) (multipart.File, *multipart.FileHeader, error)

func (*Request) FormValue

func (r *Request) FormValue(name string) string

func (*Request) Header

func (r *Request) Header() engine.Header

func (*Request) Host

func (r *Request) Host() string

func (*Request) IsTLS

func (r *Request) IsTLS() bool

func (*Request) MaxSize added in v1.6.0

func (r *Request) MaxSize() int

func (*Request) Method

func (r *Request) Method() string

func (*Request) MultipartForm

func (r *Request) MultipartForm() *multipart.Form

func (*Request) Object

func (r *Request) Object() interface{}

func (*Request) PostForm

func (r *Request) PostForm() engine.URLValuer

func (*Request) Proto

func (r *Request) Proto() string

func (*Request) RealIP

func (r *Request) RealIP() string

RealIP implements `engine.Request#RealIP` function.

func (*Request) Referer

func (r *Request) Referer() string

func (*Request) RemoteAddress

func (r *Request) RemoteAddress() string

func (*Request) Scheme

func (r *Request) Scheme() string

func (*Request) SetBody

func (r *Request) SetBody(reader io.Reader)

SetBody implements `engine.Request#SetBody` function.

func (*Request) SetHost

func (r *Request) SetHost(host string)

SetHost implements `engine.Request#SetHost` function.

func (*Request) SetMaxSize added in v1.6.0

func (r *Request) SetMaxSize(maxSize int)

func (*Request) SetMethod

func (r *Request) SetMethod(method string)

func (*Request) SetURI

func (r *Request) SetURI(uri string)

SetURI implements `engine.Request#SetURI` function.

func (*Request) SetValue added in v1.6.0

func (r *Request) SetValue(key string, value interface{})

func (*Request) Size

func (r *Request) Size() int64

Size implements `engine.Request#ContentLength` function.

func (*Request) StdRequest

func (r *Request) StdRequest() *http.Request

func (*Request) URI

func (r *Request) URI() string

func (*Request) URL

func (r *Request) URL() engine.URL

func (*Request) UserAgent

func (r *Request) UserAgent() string

func (*Request) WithContext added in v1.6.0

func (r *Request) WithContext(ctx context.Context) *http.Request

type RequestHeader

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

func (*RequestHeader) Add

func (h *RequestHeader) Add(key, val string)

func (*RequestHeader) Del

func (h *RequestHeader) Del(key string)

func (*RequestHeader) Get

func (h *RequestHeader) Get(key string) string

func (*RequestHeader) Object

func (h *RequestHeader) Object() interface{}

func (*RequestHeader) Set

func (h *RequestHeader) Set(key, val string)

func (*RequestHeader) Std

func (h *RequestHeader) Std() http.Header

func (*RequestHeader) Values added in v1.6.0

func (h *RequestHeader) Values(key string) []string

type Response

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

func NewResponse

func NewResponse(r *Request) *Response

func (*Response) Body

func (r *Response) Body() []byte

func (*Response) Committed

func (r *Response) Committed() bool

func (*Response) Error

func (r *Response) Error(errMsg string, args ...int)

func (*Response) Header

func (r *Response) Header() engine.Header

func (*Response) Hijacker added in v1.6.0

func (r *Response) Hijacker(fn func(net.Conn)) error

func (*Response) KeepBody added in v1.3.0

func (r *Response) KeepBody(_ bool)

func (*Response) NotFound

func (r *Response) NotFound()

func (*Response) Object

func (r *Response) Object() interface{}

func (*Response) Redirect

func (r *Response) Redirect(url string, code int)

func (*Response) ServeContent added in v1.6.0

func (r *Response) ServeContent(content io.ReadSeeker, name string, modtime time.Time)

func (*Response) ServeFile

func (r *Response) ServeFile(file string)

func (*Response) SetCookie

func (r *Response) SetCookie(cookie *http.Cookie)

func (*Response) SetWriter

func (r *Response) SetWriter(w io.Writer)

func (*Response) Size

func (r *Response) Size() int64

func (*Response) Status

func (r *Response) Status() int

func (*Response) StdResponseWriter

func (r *Response) StdResponseWriter() http.ResponseWriter

func (*Response) Stream added in v1.1.0

func (r *Response) Stream(step func(io.Writer) bool) (err error)

func (*Response) Write

func (r *Response) Write(b []byte) (n int, err error)

func (*Response) WriteHeader

func (r *Response) WriteHeader(code int)

func (*Response) Writer

func (r *Response) Writer() io.Writer

type ResponseHeader

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

func (*ResponseHeader) Add

func (h *ResponseHeader) Add(key, val string)

func (*ResponseHeader) Del

func (h *ResponseHeader) Del(key string)

func (*ResponseHeader) Get

func (h *ResponseHeader) Get(key string) string

func (*ResponseHeader) Object

func (h *ResponseHeader) Object() interface{}

func (*ResponseHeader) Set

func (h *ResponseHeader) Set(key, val string)

func (*ResponseHeader) Std

func (h *ResponseHeader) Std() http.Header

func (*ResponseHeader) Values added in v1.6.0

func (h *ResponseHeader) Values(key string) []string

type Server

type Server struct {
	*fasthttp.Server
	// contains filtered or unexported fields
}

func New

func New(addr string, opts ...engine.ConfigSetter) *Server

func NewWithConfig

func NewWithConfig(c *engine.Config) (s *Server)

func NewWithTLS

func NewWithTLS(addr, certFile, keyFile string, opts ...engine.ConfigSetter) *Server

func (*Server) Config added in v1.6.0

func (s *Server) Config() *engine.Config

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(c *fasthttp.RequestCtx)

func (*Server) SetHandler

func (s *Server) SetHandler(h engine.Handler)

func (*Server) SetLogger

func (s *Server) SetLogger(l logger.Logger)

func (*Server) Shutdown added in v1.6.0

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start() error

Start implements `engine.Server#Start` function.

func (*Server) Stop

func (s *Server) Stop() error

Stop implements `engine.Server#Stop` function.

type URL

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

func (*URL) Object

func (u *URL) Object() interface{}

func (*URL) Path

func (u *URL) Path() string

func (*URL) Query

func (u *URL) Query() url.Values

func (*URL) QueryValue

func (u *URL) QueryValue(name string) string

func (*URL) QueryValues

func (u *URL) QueryValues(name string) []string

func (*URL) RawPath

func (u *URL) RawPath() string

func (*URL) RawQuery

func (u *URL) RawQuery() string

func (*URL) SetPath

func (u *URL) SetPath(path string)

func (*URL) SetRawQuery added in v1.1.1

func (u *URL) SetRawQuery(rawQuery string)

func (*URL) String added in v1.1.1

func (u *URL) String() string

type UrlValue

type UrlValue struct {
	*fasthttp.Args
	// contains filtered or unexported fields
}

func (*UrlValue) Add

func (u *UrlValue) Add(key string, value string)

func (*UrlValue) All

func (u *UrlValue) All() map[string][]string

func (*UrlValue) Del

func (u *UrlValue) Del(key string)

func (*UrlValue) Encode

func (u *UrlValue) Encode() string

func (*UrlValue) Get

func (u *UrlValue) Get(key string) string

func (*UrlValue) Gets

func (u *UrlValue) Gets(key string) []string

func (*UrlValue) Merge added in v1.5.0

func (u *UrlValue) Merge(data url.Values)

func (*UrlValue) Reset

func (u *UrlValue) Reset(data url.Values)

func (*UrlValue) Set

func (u *UrlValue) Set(key string, value string)

type Value

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

func NewValue

func NewValue(c *Request) *Value

func (*Value) Add

func (v *Value) Add(key string, value string)

func (*Value) All

func (v *Value) All() map[string][]string

func (*Value) Del

func (v *Value) Del(key string)

func (*Value) Encode

func (v *Value) Encode() string

func (*Value) Get

func (v *Value) Get(key string) string

func (*Value) Gets

func (v *Value) Gets(key string) []string

func (*Value) Merge added in v1.5.0

func (v *Value) Merge(data url.Values)

func (*Value) Reset

func (v *Value) Reset(data url.Values)

func (*Value) Set

func (v *Value) Set(key string, value string)

Jump to

Keyboard shortcuts

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