Documentation
¶
Index ¶
Constants ¶
View Source
const CallbackIDFieldName = "immune_callback_id"
Variables ¶
View Source
var (
ErrFieldNotFoundInResponse = errors.New("field not found in response")
)
Functions ¶
func InjectCallbackID ¶
InjectCallbackID injects a callback id into field(expected to be a map[string]interface{} in r) in r, using CallbackIDFieldName as the key and value as the value.
Types ¶
type CallbackConfiguration ¶
type CallbackConfiguration struct { MaxWaitSeconds uint `json:"max_wait_seconds"` Port uint `json:"port"` Route string `json:"route"` SSL bool `json:"ssl" envconfig:"IMMUNE_SSL"` SSLKeyFile string `json:"ssl_key_file" envconfig:"IMMUNE_SSL_KEY_FILE"` SSLCertFile string `json:"ssl_cert_file" envconfig:"IMMUNE_SSL_CERT_FILE"` IDLocation string `json:"id_location"` }
type CallbackServer ¶
type SetupTestCase ¶
type SetupTestCase struct { Name string `json:"name"` StoreResponseVariables S `json:"store_response_variables"` RequestBody M `json:"request_body"` ResponseBody bool `json:"response_body"` Endpoint string `json:"endpoint"` HTTPMethod Method `json:"http_method"` StatusCode int `json:"status_code"` }
type SetupTestCaseReport ¶
type Signal ¶
type Signal struct { // ImmuneCallBackID collects the callback id from the request body, it's json tag // must always match immune.CallbackIDFieldName ImmuneCallBackID string `json:"immune_callback_id"` Err error }
A Signal represents a single callback
type TestCase ¶
type TestCase struct { Name string `json:"name"` Setup []string `json:"setup"` StatusCode int `json:"status_code"` HTTPMethod Method `json:"http_method"` Endpoint string `json:"endpoint"` ResponseBody bool `json:"response_body"` Callback Callback `json:"callback"` RequestBody M `json:"request_body"` }
type VariableMap ¶
type VariableMap struct {
VariableToValue M
}
func NewVariableMap ¶
func NewVariableMap() *VariableMap
func (*VariableMap) Get ¶
func (v *VariableMap) Get(key string) (interface{}, bool)
Get gets the value of key from the variable map
func (*VariableMap) GetString ¶
func (v *VariableMap) GetString(key string) (string, bool)
GetString gets the value of key from the variable map, if the value isn't of the string type, it will be converted to string via fmt.Sprintf and returned
func (*VariableMap) ProcessResponse ¶
ProcessResponse takes the variables declared in variableToField from values, and stores them in the variable map.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.