Documentation
¶
Index ¶
- type CmdOutputType
- type PreProcess
- type Request
- type Response
- func (response Response) Body() []byte
- func (response Response) ServerResponseToGenericJSON(responseFormat ResponseFormat, bodyOnly bool) (interface{}, error)
- func (response Response) ServerResponseToJsonString(bodyOnly bool) (string, error)
- func (response Response) ToGenericJSON() (interface{}, error)
- func (response Response) ToString() string
- type ResponseFormat
- type ResponseSerialization
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdOutputType ¶ added in v0.99.0
type CmdOutputType string
const ( CmdOutputStdout CmdOutputType = "stdout" CmdOutputStderr CmdOutputType = "stderr" CmdOutputExitCode CmdOutputType = "exitcode" )
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"`
QueryParams map[string]interface{} `yaml:"query_params" json:"query_params"`
QueryParamsFromStore map[string]string `yaml:"query_params_from_store" json:"query_params_from_store"`
Headers map[string]*string `yaml:"header" json:"header"`
HeaderFromStore map[string]string `yaml:"header_from_store" json:"header_from_store"`
BodyType string `yaml:"body_type" json:"body_type"`
BodyFile string `yaml:"body_file" json:"body_file"`
Body interface{} `yaml:"body" json:"body"`
DoNotStore bool
ManifestDir string
DataStore *datastore.Datastore
// contains filtered or unexported fields
}
type Response ¶
type Response struct {
Format ResponseFormat
// contains filtered or unexported fields
}
func NewResponse ¶
func NewResponse(statusCode int, headers map[string][]string, body io.Reader, bodyControl util.JsonObject, bodyFormat ResponseFormat) (res Response, err error)
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) (interface{}, 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", "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][]string `yaml:"header" json:"header,omitempty"`
Body interface{} `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.