Documentation
¶
Index ¶
- Variables
- func NewHTTPClientChan(ctx *dsl.Ctx, opts interface{}) (dsl.Chan, error)
- type HTTPClient
- func (c *HTTPClient) Close(ctx *dsl.Ctx) error
- func (c *HTTPClient) DocSpec() *dsl.DocSpec
- func (c *HTTPClient) Kill(ctx *dsl.Ctx) error
- func (c *HTTPClient) Kind() dsl.ChanKind
- func (c *HTTPClient) Open(ctx *dsl.Ctx) error
- func (c *HTTPClient) Pub(ctx *dsl.Ctx, m dsl.Msg) error
- func (c *HTTPClient) Recv(ctx *dsl.Ctx) chan dsl.Msg
- func (c *HTTPClient) Sub(ctx *dsl.Ctx, topic string) error
- func (c *HTTPClient) To(ctx *dsl.Ctx, m dsl.Msg) error
- type HTTPClientOpts
- type HTTPRequest
- type HTTPRequestCtl
- type HTTPResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultBufferSize = 1024
)
Functions ¶
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient is an HTTP client Chan.
This channel type implements HTTP requests. A test publishes a request that includes a URL. This channel performs the HTTP request and then forwards the response for the test to receive.
func (*HTTPClient) DocSpec ¶
func (c *HTTPClient) DocSpec() *dsl.DocSpec
func (*HTTPClient) Kind ¶
func (c *HTTPClient) Kind() dsl.ChanKind
type HTTPClientOpts ¶
type HTTPClientOpts struct {
}
HTTPClientOpts configures an HTTPClient.
Currently this channel doesn't have any configuration.
type HTTPRequest ¶
type HTTPRequest struct {
// Method is the usual HTTP request method (e.g., GET, POST).
Method string `json:"method"`
// URL is the target for the request.
URL string `json:"url"`
// Headers is map of HTTP header names to values.
Headers map[string][]string `json:"headers"`
// Body is the request body.
Body interface{} `json:"body,omitempty"`
// RequestBodySerialization specifies what serialization
// (if any) to perform on the request's body.
//
// Possible values are 'string' and 'json' (default).
RequestBodySerialization dsl.Serialization `json:"requestBodySerialization,omitempty" yaml:"requestbodyserialization,omitempty"`
// ResponseBodyDeserialization specifies what deserialization
// (if any) to perform on the response's body.
//
// Possible values are 'string' and 'json' (default).
ResponseBodyDeserialization dsl.Serialization `json:"responseBodyDeserialization,omitempty" yaml:"responsebodydeserialization,omitempty"`
// Form can contain form values, and you can specify these
// values instead of providing an explicit Body.
Form url.Values `json:"form,omitempty"`
// HTTPRequestCtl is optional data for managing polling
// requests.
HTTPRequestCtl `json:"ctl,omitempty" yaml:"ctl"`
// Insecure if true will skip server credentials verification.
Insecure bool `json:"insecure,omitempty"`
// contains filtered or unexported fields
}
HTTPRequest represents a complete HTTP request, which is typically provided as a message payload in JSON.
type HTTPRequestCtl ¶
type HTTPRequestCtl struct {
// Id is used to refer to this request when it has a polling
// interval.
Id string `json:"id,omitempty"`
// PollInterval, when not zero, will cause this channel to
// repeated the HTTP request at this interval.
//
// The timer starts after the last request has completed.
// (Previously the timer fired requests at this interval
// regardless of the latency of the previous HTTP request(s).)
//
// Value should be a string that time.ParseDuration can parse.
PollInterval string `json:"pollInterval"`
// Terminate, when not zero, should be the Id of a previous polling
// request, and that polling request will be terminated.
//
// No other properties in this struct should be provided.
Terminate string `json:"terminate,omitempty"`
// contains filtered or unexported fields
}
HTTPRequestCtl directs management of polling requests (if any).
type HTTPResponse ¶
type HTTPResponse struct {
// StatusCode is the HTTP status code returned by the HTTP server.
StatusCode int `json:"statuscode" yaml:"statuscode"`
// Body is the either the raw body or parsed body returned by
// the HTTP server.
//
// The requests's ResponseBodyDeserialization determines if
// and how deserialization occurs.
Body interface{} `json:"body"`
// Error describes a channel processing error (if any) that
// occured during the request or response.
Error string `json:"error,omitempty"`
// Headers contains the response headers from the HTTP server.
Headers map[string][]string `json:"headers"`
}
HTTPResponse represents the HTTP response received from the HTTP server.
Click to show internal directories.
Click to hide internal directories.