Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (client *Client) CreateJsonResponse(data interface{}) *SimpleResponse
- func (client *Client) CreateResponse(statusCode int) *SimpleResponse
- func (client *Client) IsContentJson() bool
- func (client *Client) ResponseBody(body string) *SimpleResponse
- func (client *Client) ResponseBodyBytes(body []byte) *SimpleResponse
- func (client *Client) ResponseFile(file string) *SimpleResponse
- func (client *Client) ResponseReader(readHolder rangeReadHolder) *SimpleResponse
- type ForwardResponse
- type MiniServer
- type Response
- type SimpleResponse
Constants ¶
View Source
const ( ContentText = "text/plain" ContentHtml = "text/html" ContentJson = "application/json" ContentJavascript = "text/javascript" ContentCss = "text/css" ContentXIcon = "image/x-icon" ContentSVG = "image/svg+xml" ContentOgg = "audio/ogg" ContentOctetStream = "application/octet-stream" ContentWasm = "application/wasm" )
Variables ¶
View Source
var FileExtensions = [][]string{ {"html", ContentHtml}, {"js", ContentJavascript}, {"css", ContentCss}, {"ico", ContentXIcon}, {"svg", ContentSVG}, {"ogg", ContentOgg}, {"wasm", ContentWasm}, }
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Host, Url, Method, IPAddr string
Request []byte
Header http.Header
Queries url.Values
}
func (*Client) CreateJsonResponse ¶
func (client *Client) CreateJsonResponse(data interface{}) *SimpleResponse
func (*Client) CreateResponse ¶
func (client *Client) CreateResponse(statusCode int) *SimpleResponse
func (*Client) IsContentJson ¶
func (*Client) ResponseBody ¶
func (client *Client) ResponseBody(body string) *SimpleResponse
func (*Client) ResponseBodyBytes ¶
func (client *Client) ResponseBodyBytes(body []byte) *SimpleResponse
func (*Client) ResponseFile ¶
func (client *Client) ResponseFile(file string) *SimpleResponse
func (*Client) ResponseReader ¶
func (client *Client) ResponseReader(readHolder rangeReadHolder) *SimpleResponse
type ForwardResponse ¶
type ForwardResponse struct {
// contains filtered or unexported fields
}
func NewForwardResponse ¶
func NewForwardResponse(u string) *ForwardResponse
type MiniServer ¶
type MiniServer struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(port int) *MiniServer
func (*MiniServer) StartListening ¶
func (miniserver *MiniServer) StartListening(callback func(client *Client) Response)
func (*MiniServer) StopListening ¶
func (miniserver *MiniServer) StopListening()
type SimpleResponse ¶
type SimpleResponse struct {
// contains filtered or unexported fields
}
func (*SimpleResponse) SetContentType ¶
func (response *SimpleResponse) SetContentType(contentType string)
func (*SimpleResponse) SetHeader ¶
func (response *SimpleResponse) SetHeader(key, value string)
func (*SimpleResponse) SetStatusCode ¶
func (response *SimpleResponse) SetStatusCode(code int)
Click to show internal directories.
Click to hide internal directories.