Documentation
¶
Index ¶
- Constants
- func MarshalBodyIfJSON(data, m map[string]any)
- 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 MarshalBodyIfJSON ¶ added in v1.18.0
MarshalBodyIfJSON converts body to JSON string when Content-Type is application/json Supports map[string]any and []any body types
func RequestStep ¶ added in v1.19.0
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 ¶ added in v1.18.0
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 ¶ added in v1.18.0
type Res ¶ added in v1.18.0
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"`
}