Documentation
¶
Index ¶
- Constants
- func Keeps() []string
- func MarshalBodyIfJSON(data, m map[string]any)
- func Params() []string
- func Request(data map[string]any, opts ...Option) (map[string]any, error)
- func RequestStep(call actionrpc.Call, opts ...Option) (map[string]any, map[string]any, error)
- func ResolveMethodAndURL(data map[string]any) error
- func Serve()
- type Action
- type Callback
- type Option
- type Req
- type Res
- type Result
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout bounds a request when the step does not set `timeout`. The zero value of http.Client means "wait forever", which lets a single unresponsive endpoint hold a workflow open until the step timeout fires.
const DefaultTraceHeader = "X-Probe-Trace"
DefaultTraceHeader is the header trace_header: true sends.
Variables ¶
This section is empty.
Functions ¶
func Keeps ¶
func Keeps() []string
Keeps returns the kinds of guard the http action keeps to: it sends only GET, HEAD and OPTIONS under read-only, and connects only to a host the guard allows, redirects included.
func MarshalBodyIfJSON ¶
MarshalBodyIfJSON converts body to JSON string when Content-Type is application/json Supports map[string]any and []any body types
func Params ¶
func Params() []string
Params returns the keys the http action takes in with: those of Req, the method shorthands, such as get and post, and those it reads apart from Req.
func RequestStep ¶
RequestStep is Request for a step, with the state the action keeps in a job. When keep_cookies is true, the cookies kept in the state are sent, and the state returned keeps those the server set as well; otherwise the state returned is nil, which leaves the job's state as it was. When trace_header is given, the request carries a header that names the run, job and step.
func ResolveMethodAndURL ¶
ResolveMethodAndURL resolves HTTP method fields and updates the data map Converts method fields like "get", "post" to "method" and "url" fields
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
type Req ¶
type Res ¶
type Res struct {
Status string `map:"status"`
Code int `map:"code"`
Header map[string]string `map:"headers"`
Body string `map:"body"` // Changed from []byte to string for text data
FilePath string `map:"filepath"` // New field for binary file paths
// Cookies holds the names and values of the cookies the server set, on
// redirects included.
Cookies map[string]string `map:"cookies"`
}