Set the response callback to be called to determine if a response was expected/successful or not.
The result of this is that requests will be tagged with expected_response "true" or "false" and http_req_failed will be emitted with the reverse. This does include all redirects so if for a request only 200 is the expected response and there is 301 redirect before that, the redirect will be marked as failed as only status code 200 was marked as expected.
Due to implementation specifics:
- Requests with authentication digest are always expected to first get 401 and then to get whatever was specified.
- Requests with authentication ntlm will let a 401 status code on the first request as well as anything defined by expectedStatuses
Setting the callback to null disables the tagging with expected_response and the emitting of http_req_failed.
It is recommended that if a per request responseCallback is used with Params it is actually defined once and used instead of creating it on each request.