Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CmdOutputType ¶ added in v0.99.0
type CmdOutputType string
const ( CmdOutputStdout CmdOutputType = "stdout" CmdOutputStderr CmdOutputType = "stderr" CmdOutputExitCode CmdOutputType = "exitcode" )
type Cookie ¶ added in v0.100.0
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path,omitempty"`
Domain string `json:"domain,omitempty"`
Expires time.Time `json:"expires,omitempty"`
MaxAge int `json:"max_age,omitempty"`
Secure bool `json:"secure,omitempty"`
HttpOnly bool `json:"http_only,omitempty"`
SameSite http.SameSite `json:"same_site,omitempty"`
}
Cookie definition
type PreProcess ¶ added in v0.90.0
type PreProcess struct {
Cmd struct {
Name string `json:"name"`
Args []string `json:"args,omitempty"`
Output CmdOutputType `json:"output,omitempty"`
} `json:"cmd"`
}
func (*PreProcess) RunPreProcess ¶ added in v0.90.0
func (proc *PreProcess) RunPreProcess(response Response) (Response, error)
type Request ¶
type Request struct {
Endpoint string `yaml:"endpoint" json:"endpoint"`
ServerURL string `yaml:"server_url" json:"server_url"`
Method string `yaml:"method" json:"method"`
NoRedirect bool `yaml:"no_redirect" json:"no_redirect"`
QueryParams map[string]any `yaml:"query_params" json:"query_params"`
QueryParamsFromStore map[string]string `yaml:"query_params_from_store" json:"query_params_from_store"`
Headers map[string]any `yaml:"header" json:"header"`
HeaderFromStore map[string]string `yaml:"header_from_store" json:"header_from_store"`
Cookies map[string]*RequestCookie `yaml:"cookies" json:"cookies"`
SetCookies []*Cookie `yaml:"header-x-test-set-cookie" json:"header-x-test-set-cookie"`
BodyType string `yaml:"body_type" json:"body_type"`
BodyFile string `yaml:"body_file" json:"body_file"`
Body any `yaml:"body" json:"body"`
ManifestDir string
DataStore *datastore.Datastore
// contains filtered or unexported fields
}
type RequestCookie ¶ added in v0.100.0
type Response ¶
type Response struct {
StatusCode int
Headers map[string]any
HeaderFlat map[string]any // ":control" is an object, so we must use "any" here
Cookies []*http.Cookie
Body []byte
BodyControl util.JsonObject
Format ResponseFormat
ReqDur time.Duration
BodyLoadDur time.Duration
}
func NewResponse ¶
func NewResponseFromSpec ¶
func NewResponseFromSpec(spec ResponseSerialization) (res Response, err error)
func (Response) ServerResponseToGenericJSON ¶ added in v0.90.0
func (response Response) ServerResponseToGenericJSON(responseFormat ResponseFormat, bodyOnly bool) (any, error)
ServerResponseToGenericJSON parse response from server. convert xml, csv, binary to json if necessary
func (Response) ServerResponseToJsonString ¶ added in v0.90.0
func (Response) ToGenericJSON ¶ added in v0.90.0
ToGenericJSON parse expected response
type ResponseFormat ¶ added in v0.90.0
type ResponseFormat struct {
IgnoreBody bool `json:"-"` // if true, do not try to parse the body (since it is not expected in the response)
Type string `json:"type"` // default "json", allowed: "csv", "json", "xml", "xml2", "html", "xhtml", "binary"
CSV struct {
Comma string `json:"comma,omitempty"`
} `json:"csv,omitempty"`
PreProcess *PreProcess `json:"pre_process,omitempty"`
}
type ResponseSerialization ¶
type ResponseSerialization struct {
StatusCode int `yaml:"statuscode" json:"statuscode"`
Headers map[string]any `yaml:"header" json:"header,omitempty"`
Cookies map[string]Cookie `yaml:"cookie" json:"cookie,omitempty"`
Body any `yaml:"body" json:"body,omitempty"`
BodyControl util.JsonObject `yaml:"body:control" json:"body:control,omitempty"`
Format ResponseFormat `yaml:"format" json:"format,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.