(expectedResponse, actualResponse *backendResponse)
| 176 | } |
| 177 | |
| 178 | func (p *ProxyEndpoint) compareResponses(expectedResponse, actualResponse *backendResponse) error { |
| 179 | // compare response body only if we get a 200 |
| 180 | if expectedResponse.status != 200 { |
| 181 | return fmt.Errorf("skipped comparison of response because we got status code %d from preferred backend's response", expectedResponse.status) |
| 182 | } |
| 183 | |
| 184 | if actualResponse.status != 200 { |
| 185 | return fmt.Errorf("skipped comparison of response because we got status code %d from secondary backend's response", actualResponse.status) |
| 186 | } |
| 187 | |
| 188 | if expectedResponse.status != actualResponse.status { |
| 189 | return fmt.Errorf("expected status code %d but got %d", expectedResponse.status, actualResponse.status) |
| 190 | } |
| 191 | |
| 192 | return p.comparator.Compare(expectedResponse.body, actualResponse.body) |
| 193 | } |
| 194 | |
| 195 | type backendResponse struct { |
| 196 | backend *ProxyBackend |
no test coverage detected