Documentation ¶
Index ¶
- Constants
- Variables
- func ListenAndServe(addr string, handler Handler) error
- func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error
- func NewError(log any) *serverError
- func NewHTTPError(statusCode int, log any) *serverError
- func Serve(l net.Listener, handler Handler) error
- func ServeTLS(l net.Listener, handler Handler, certFile string, keyFile string) error
- type Event
- type Handler
- type Request
- func (this *Request) AllFiles() map[string][]*multipart.FileHeader
- func (this *Request) AllHeaders() http.Header
- func (this *Request) AllParams() map[string][]string
- func (this *Request) Body() []byte
- func (this *Request) File(paramName string) *multipart.FileHeader
- func (this *Request) Files(paramName string) []*multipart.FileHeader
- func (this *Request) Float32Param(paramName string) float32
- func (this *Request) Float64Param(paramName string) float64
- func (this *Request) Header(name string) string
- func (this *Request) Headers(name string) []string
- func (this *Request) IntParam(paramName string) int
- func (this *Request) IsDone() bool
- func (this *Request) Param(paramName string) string
- func (this *Request) Params(paramName string) []string
- func (this *Request) UIntParam(paramName string) uint
- type Response
- func (this *Response) Flush(data []byte) error
- func (this *Response) FlushEvent(event *Event) error
- func (this *Response) FlushText(text string) error
- func (this *Response) Header(key, value string) *Response
- func (this *Response) Headers(headers map[string][]string) *Response
- func (this *Response) MustSupportFlusher()
- func (this *Response) NoBody()
- func (this *Response) Render(filePath string)
- func (this *Response) Status(status int) *Response
- func (this *Response) SupportFlusher() bool
- func (this *Response) View(key string, value string) *Response
- func (this *Response) Write(data []byte)
- func (this *Response) WriteJSON(value any)
- func (this *Response) WriteText(text string)
- type Server
- func (this *Server) All(pattern string, webserverHandler Handler) *Server
- func (this *Server) Delete(pattern string, webserverHandler Handler) *Server
- func (this *Server) FileServer(pattern string)
- func (this *Server) FileServerStrippingPrefix(pattern string, stripPrefix string)
- func (this *Server) Get(pattern string, webserverHandler Handler) *Server
- func (this *Server) Handle(method string, pattern string, handler Handler) *Server
- func (this *Server) HandleAll(pattern string, webserverHandler Handler) *Server
- func (this *Server) ListenAndServe(addr string) error
- func (this *Server) ListenAndServeTLS(addr, certFile, keyFile string) error
- func (this *Server) MultiHandle(methods []string, pattern string, handler Handler) *Server
- func (this *Server) Post(pattern string, webserverHandler Handler) *Server
- func (this *Server) Put(pattern string, webserverHandler Handler) *Server
- func (this *Server) Render(pattern string, filePath string) *Server
- func (this *Server) Serve(l net.Listener) error
- func (this *Server) ServeTLS(l net.Listener, certFile string, keyFile string) error
- func (this *Server) Write(pattern string, data []byte) *Server
- func (this *Server) WriteJSON(pattern string, filePath string) *Server
- func (this *Server) WriteText(pattern string, text string) *Server
Constants ¶
View Source
const ( ContentTypeHeader = "Content-Type" ContentTypeFormUrlEncoded = "application/x-www-form-urlencoded" ContentTypeFormData = "multipart/form-data" ContentTypeJson = "application/json" ContentTypeEventStream = "text/event-stream" )
Variables ¶
View Source
var EventStreamHeader = map[string][]string{ ContentTypeHeader: {ContentTypeEventStream}, "Cache-Control": {"no-cache"}, "Connection": {"keep-alive"}, }
Functions ¶
func ListenAndServe ¶
func ListenAndServeTLS ¶
func NewHTTPError ¶
Types ¶
type Request ¶
func (*Request) AllHeaders ¶
func (*Request) Float32Param ¶
func (*Request) Float64Param ¶
type Response ¶
type Response struct { RawWriter http.ResponseWriter RawFS http.FileSystem // contains filtered or unexported fields }
func (*Response) FlushEvent ¶
func (*Response) MustSupportFlusher ¶
func (this *Response) MustSupportFlusher()
func (*Response) SupportFlusher ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServerWithFS ¶
func NewServerWithFS(fileSystem http.FileSystem) *Server
func (*Server) FileServer ¶
func (*Server) FileServerStrippingPrefix ¶
func (*Server) ListenAndServe ¶
func (*Server) ListenAndServeTLS ¶
func (*Server) MultiHandle ¶
Click to show internal directories.
Click to hide internal directories.