Documentation
¶
Index ¶
- type BasicRequest
- func (br *BasicRequest) GetBody() io.ReadCloser
- func (br *BasicRequest) GetCookies() []*http.Cookie
- func (br *BasicRequest) GetHeaders() KeyValues
- func (br *BasicRequest) GetMethod() string
- func (br *BasicRequest) GetQueryParameters() KeyValues
- func (br *BasicRequest) GetURL() string
- func (br *BasicRequest) GetURLParameters() KeyValue
- type BasicRoute
- func (br *BasicRoute) Delete(handlers ...Handler) IRoute
- func (br *BasicRoute) Get(handlers ...Handler) IRoute
- func (br *BasicRoute) Match(targetURL string) bool
- func (br *BasicRoute) Patch(handlers ...Handler) IRoute
- func (br *BasicRoute) Post(handlers ...Handler) IRoute
- func (br *BasicRoute) Put(handlers ...Handler) IRoute
- type HTTPResponseWriterWrapper
- func (w *HTTPResponseWriterWrapper) Bytes(bytes []byte) IResponse
- func (w *HTTPResponseWriterWrapper) Header(key string, value string) IResponse
- func (w *HTTPResponseWriterWrapper) JSON(data interface{}) IResponse
- func (w *HTTPResponseWriterWrapper) Status(statusCode int) IResponse
- func (w *HTTPResponseWriterWrapper) Text(text string) IResponse
- type Handler
- type IRequest
- type IResponse
- type IRoute
- type KeyValue
- type KeyValues
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicRequest ¶
type BasicRequest struct {
URL string
Method string
Headers KeyValues
Cookies []*http.Cookie
URLParameters KeyValue
QueryParameters KeyValues
Body io.ReadCloser
}
func (*BasicRequest) GetBody ¶
func (br *BasicRequest) GetBody() io.ReadCloser
func (*BasicRequest) GetCookies ¶
func (br *BasicRequest) GetCookies() []*http.Cookie
func (*BasicRequest) GetHeaders ¶
func (br *BasicRequest) GetHeaders() KeyValues
func (*BasicRequest) GetMethod ¶
func (br *BasicRequest) GetMethod() string
func (*BasicRequest) GetQueryParameters ¶
func (br *BasicRequest) GetQueryParameters() KeyValues
func (*BasicRequest) GetURL ¶
func (br *BasicRequest) GetURL() string
func (*BasicRequest) GetURLParameters ¶
func (br *BasicRequest) GetURLParameters() KeyValue
type BasicRoute ¶
type BasicRoute struct {
// contains filtered or unexported fields
}
func NewBasicRoute ¶
func NewBasicRoute(url string) *BasicRoute
func (*BasicRoute) Delete ¶ added in v1.1.0
func (br *BasicRoute) Delete(handlers ...Handler) IRoute
func (*BasicRoute) Get ¶ added in v1.1.0
func (br *BasicRoute) Get(handlers ...Handler) IRoute
func (*BasicRoute) Match ¶
func (br *BasicRoute) Match(targetURL string) bool
func (*BasicRoute) Patch ¶ added in v1.1.0
func (br *BasicRoute) Patch(handlers ...Handler) IRoute
func (*BasicRoute) Post ¶ added in v1.1.0
func (br *BasicRoute) Post(handlers ...Handler) IRoute
func (*BasicRoute) Put ¶ added in v1.1.0
func (br *BasicRoute) Put(handlers ...Handler) IRoute
type HTTPResponseWriterWrapper ¶
type HTTPResponseWriterWrapper struct {
// contains filtered or unexported fields
}
A wrapper of http.ResponseWriter that implements IResponse
func (*HTTPResponseWriterWrapper) Bytes ¶
func (w *HTTPResponseWriterWrapper) Bytes(bytes []byte) IResponse
Write bytes to the body
func (*HTTPResponseWriterWrapper) Header ¶
func (w *HTTPResponseWriterWrapper) Header(key string, value string) IResponse
Set a new header (Writes directly to http.ResponseWriter because the only thing that matters is the headers to be written first)
func (*HTTPResponseWriterWrapper) JSON ¶
func (w *HTTPResponseWriterWrapper) JSON(data interface{}) IResponse
Write JSON to the body (also updates Content-Type header)
func (*HTTPResponseWriterWrapper) Status ¶
func (w *HTTPResponseWriterWrapper) Status(statusCode int) IResponse
Writes a status code
func (*HTTPResponseWriterWrapper) Text ¶
func (w *HTTPResponseWriterWrapper) Text(text string) IResponse
Write text to the body
type IRequest ¶
type IRequest interface {
GetURL() string
GetMethod() string
GetHeaders() KeyValues
GetCookies() []*http.Cookie
GetURLParameters() KeyValue
GetQueryParameters() KeyValues
GetBody() io.ReadCloser
// contains filtered or unexported methods
}
func NewBasicRequest ¶
type IResponse ¶
type IResponse interface {
Status(statusCode int) IResponse
Header(key string, value string) IResponse
Bytes(data []byte) IResponse
Text(text string) IResponse
JSON(data interface{}) IResponse
// contains filtered or unexported methods
}
func NewHTTPResponseWriter ¶
func NewHTTPResponseWriter(rw http.ResponseWriter) IResponse
Click to show internal directories.
Click to hide internal directories.