Documentation
¶
Overview ¶
Package httpresponse contains the httpResponse node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPResponse ¶
HTTPResponse answers the HTTP request that injected the current message. It correlates via the msgId in payload.Metadata, set by httpTrigger. Response status and headers travel back through the message metadata so the trigger handler can write them.
func NewHTTPResponse ¶
func NewHTTPResponse(node nodestore.NodeInterface, config *HTTPResponseConfig, host nodebase.NodeHost) *HTTPResponse
NewHTTPResponse creates a new HTTP response node
func (*HTTPResponse) Execute ¶
func (n *HTTPResponse) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute resolves the pending request associated with the message
type HTTPResponseConfig ¶
type HTTPResponseConfig struct {
// StatusCode is the HTTP status sent with the reply (default 200).
// Overridden per message by Metadata["statusCode"] or
// Data["statusCode"] — Node-RED's msg.statusCode equivalent.
StatusCode int `json:"statusCode"`
// Headers are extra response headers. Per-message
// Metadata["headers"] / Data["headers"] maps are merged on top —
// Node-RED's msg.headers equivalent.
Headers map[string]string `json:"headers,omitempty"`
}
HTTPResponseConfig holds configuration for the HTTP response node