(req requests.Request, resp *requests.Response)
| 288 | } |
| 289 | |
| 290 | func (this *Rule) MatchResponse(req requests.Request, resp *requests.Response) (b bool, hasRequestBody bool, err error) { |
| 291 | if this.singleCheckpoint != nil { |
| 292 | // if is request param |
| 293 | if this.singleCheckpoint.IsRequest() { |
| 294 | value, hasCheckRequestBody, err, _ := this.singleCheckpoint.RequestValue(req, this.singleParam, this.CheckpointOptions, this.Id) |
| 295 | if hasCheckRequestBody { |
| 296 | hasRequestBody = true |
| 297 | } |
| 298 | if err != nil { |
| 299 | return false, hasRequestBody, err |
| 300 | } |
| 301 | |
| 302 | // execute filters |
| 303 | if len(this.ParamFilters) > 0 { |
| 304 | value = this.execFilter(value) |
| 305 | } |
| 306 | |
| 307 | return this.Test(value), hasRequestBody, nil |
| 308 | } |
| 309 | |
| 310 | // response param |
| 311 | value, hasCheckRequestBody, err, _ := this.singleCheckpoint.ResponseValue(req, resp, this.singleParam, this.CheckpointOptions, this.Id) |
| 312 | if hasCheckRequestBody { |
| 313 | hasRequestBody = true |
| 314 | } |
| 315 | if err != nil { |
| 316 | return false, hasRequestBody, err |
| 317 | } |
| 318 | |
| 319 | // if is composed checkpoint, we just returns true or false |
| 320 | if this.singleCheckpoint.IsComposed() { |
| 321 | return types.Bool(value), hasRequestBody, nil |
| 322 | } |
| 323 | |
| 324 | return this.Test(value), hasRequestBody, nil |
| 325 | } |
| 326 | |
| 327 | var value = configutils.ParseVariables(this.Param, func(varName string) (value string) { |
| 328 | var pieces = strings.SplitN(varName, ".", 2) |
| 329 | var prefix = pieces[0] |
| 330 | point, ok := this.multipleCheckpoints[prefix] |
| 331 | if !ok { |
| 332 | return "" |
| 333 | } |
| 334 | |
| 335 | if len(pieces) == 1 { |
| 336 | if point.IsRequest() { |
| 337 | value1, hasCheckRequestBody, err1, _ := point.RequestValue(req, "", this.CheckpointOptions, this.Id) |
| 338 | if hasCheckRequestBody { |
| 339 | hasRequestBody = true |
| 340 | } |
| 341 | if err1 != nil { |
| 342 | err = err1 |
| 343 | } |
| 344 | return this.stringifyValue(value1) |
| 345 | } else { |
| 346 | value1, hasCheckRequestBody, err1, _ := point.ResponseValue(req, resp, "", this.CheckpointOptions, this.Id) |
| 347 | if hasCheckRequestBody { |
nothing calls this directly
no test coverage detected