chans

package
Version: v0.8.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBufferSize = 1024
)

Functions

func NewHTTPClientChan

func NewHTTPClientChan(ctx *dsl.Ctx, opts interface{}) (dsl.Chan, error)

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) Close

func (c *HTTPClient) Close(ctx *dsl.Ctx) error

func (*HTTPClient) DocSpec

func (c *HTTPClient) DocSpec() *dsl.DocSpec

func (*HTTPClient) Kill

func (c *HTTPClient) Kill(ctx *dsl.Ctx) error

func (*HTTPClient) Kind

func (c *HTTPClient) Kind() dsl.ChanKind

func (*HTTPClient) Open

func (c *HTTPClient) Open(ctx *dsl.Ctx) error

func (*HTTPClient) Pub

func (c *HTTPClient) Pub(ctx *dsl.Ctx, m dsl.Msg) error

func (*HTTPClient) Recv

func (c *HTTPClient) Recv(ctx *dsl.Ctx) chan dsl.Msg

func (*HTTPClient) Sub

func (c *HTTPClient) Sub(ctx *dsl.Ctx, topic string) error

func (*HTTPClient) To

func (c *HTTPClient) To(ctx *dsl.Ctx, m dsl.Msg) error

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL