Documentation ¶
Index ¶
- Variables
- func NewHTTPServerChan(ctx *dsl.Ctx, opts interface{}) (dsl.Chan, error)
- type HTTPServer
- func (c *HTTPServer) Close(ctx *dsl.Ctx) error
- func (c *HTTPServer) DocSpec() *dsl.DocSpec
- func (c *HTTPServer) Kill(ctx *dsl.Ctx) error
- func (c *HTTPServer) Kind() dsl.ChanKind
- func (c *HTTPServer) Open(ctx *dsl.Ctx) error
- func (c *HTTPServer) Pub(ctx *dsl.Ctx, m dsl.Msg) error
- func (c *HTTPServer) Recv(ctx *dsl.Ctx) chan dsl.Msg
- func (c *HTTPServer) Sub(ctx *dsl.Ctx, topic string) error
- func (c *HTTPServer) To(ctx *dsl.Ctx, m dsl.Msg) error
- type HTTPServerOpts
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultHTTPServerBufferSize is the default size of the // buffer of in-coming HTTP request messages. DefaultHTTPServerBufferSize = 1024 )
Functions ¶
Types ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is an HTTP server Chan.
An HTTPServer will emit the requests it receives from HTTP clients, and the server should receive the responses to forward to those clients.
To use this channel, you first 'recv' a client request, and then you 'pub' the response, which the Chan will forward to the HTTP client.
Note that you have to do 'pub' each specific response for each client request.
func (*HTTPServer) DocSpec ¶
func (c *HTTPServer) DocSpec() *dsl.DocSpec
func (*HTTPServer) Kind ¶
func (c *HTTPServer) Kind() dsl.ChanKind
type HTTPServerOpts ¶
type HTTPServerOpts struct { Host string `json:"host"` Port int `json:"port"` ParseJSON bool `json:"parsejson" yaml:"parsejson"` }
HTTPServerOpts configures an HTTPServer channel.
type Request ¶ added in v0.5.1
type Request struct { Path string `json:"path"` // Form is the parsed form values. Form url.Values `json:"form,omitempty"` // Header is the map from header name to header values. Headers map[string][]string `json:"headers,omitempty"` // Method is the HTTP request method. Method string `json:"method"` // Body is the request body (if any). // // This body is parsed as JSON if ParsedJSON is true. Body interface{} `json:"body,omitempty"` // Error is a generic error message (if any). Error string `json:"error,omitempty"` }
type Response ¶ added in v0.5.1
type Response struct { // Header is the map from header name to header values. Headers map[string][]string `json:"headers,omitempty"` // Body is the response body. Body interface{} `json:"body,omitempty"` StatusCode int `json:"statuscode,omitempty"` // Serialization is the serialization used to make a string // representation of the body. Serialization *dsl.Serialization `json:"serialization,omitempty"` }
Click to show internal directories.
Click to hide internal directories.