MCPcopy Index your code
hub / github.com/SpectoLabs/hoverfly / Test_Hoverfly_processRequest_CanModifyResponse

Function Test_Hoverfly_processRequest_CanModifyResponse

core/hoverfly_test.go:232–254  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func 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
256type ResponseDelayListStub struct {
257 gotDelays int

Callers

nothing calls this directly

Calls 5

testToolsFunction · 0.85
SetBinaryMethod · 0.80
SetScriptMethod · 0.80
processRequestMethod · 0.80
SetModeMethod · 0.45

Tested by

no test coverage detected