(t *testing.T)
| 230 | } |
| 231 | |
| 232 | func Test_Hoverfly_processRequest_CanModifyResponse(t *testing.T) { |
| 233 | RegisterTestingT(t) |
| 234 | |
| 235 | server, unit := testTools(201, `{'message': 'here'}`) |
| 236 | defer server.Close() |
| 237 | |
| 238 | err := unit.Cfg.Middleware.SetBinary("python") |
| 239 | Expect(err).To(BeNil()) |
| 240 | |
| 241 | err = unit.Cfg.Middleware.SetScript(pythonModifyResponse) |
| 242 | Expect(err).To(BeNil()) |
| 243 | |
| 244 | r, err := http.NewRequest("POST", "http://somehost.com", nil) |
| 245 | Expect(err).To(BeNil()) |
| 246 | |
| 247 | unit.Cfg.SetMode("modify") |
| 248 | newResp, _ := unit.processRequest(r) |
| 249 | |
| 250 | Expect(newResp).ToNot(BeNil()) |
| 251 | |
| 252 | Expect(newResp.StatusCode).To(Equal(http.StatusCreated)) |
| 253 | Expect(newResp.Header).To(HaveKeyWithValue("Hoverfly", []string{"Was-Here"})) |
| 254 | } |
| 255 | |
| 256 | type ResponseDelayListStub struct { |
| 257 | gotDelays int |
nothing calls this directly
no test coverage detected