StatusRange sets a criteria based on the Status code of the response for the Response Handler. Its Handler will only be called if the response has a status code between the min and max. If min is greater than max, the values are switched.
(min, max int)
| 220 | // Its Handler will only be called if the response has a status code between the min and max. |
| 221 | // If min is greater than max, the values are switched. |
| 222 | func (r *ResponseMatcher) StatusRange(min, max int) *ResponseMatcher { |
| 223 | if min > max { |
| 224 | min, max = max, min |
| 225 | } |
| 226 | r.mux.mu.Lock() |
| 227 | defer r.mux.mu.Unlock() |
| 228 | r.minStatus = min |
| 229 | r.maxStatus = max |
| 230 | return r |
| 231 | } |
| 232 | |
| 233 | // Scheme sets a criteria based on the scheme of the URL for the Response Handler. Its Handler |
| 234 | // will only be called if the scheme of the URL matches exactly the specified scheme. |