MCPcopy
hub / github.com/grpc/grpc-go / overrideHTTPClientGood

Function overrideHTTPClientGood

credentials/sts/sts_test.go:134–144  ·  view source on GitHub ↗

Overrides the http.Client with a fakeClient which sends a good response.

()

Source from the content-addressed store, hash-verified

132
133// Overrides the http.Client with a fakeClient which sends a good response.
134func overrideHTTPClientGood() (*testutils.FakeHTTPClient, func()) {
135 fc := &testutils.FakeHTTPClient{
136 ReqChan: testutils.NewChannel(),
137 RespChan: testutils.NewChannel(),
138 }
139 fc.RespChan.Send(makeGoodResponse())
140
141 origMakeHTTPDoer := makeHTTPDoer
142 makeHTTPDoer = func(_ *x509.CertPool) httpDoer { return fc }
143 return fc, func() { makeHTTPDoer = origMakeHTTPDoer }
144}
145
146// Overrides the http.Client with the provided fakeClient.
147func overrideHTTPClient(fc *testutils.FakeHTTPClient) func() {

Calls 3

NewChannelFunction · 0.92
makeGoodResponseFunction · 0.85
SendMethod · 0.65

Tested by

no test coverage detected