MCPcopy Create free account
hub / github.com/cli/cli / extensionHTTPClient

Function extensionHTTPClient

pkg/cmd/extension/http_test.go:15–27  ·  view source on GitHub ↗
(t *testing.T, path string, status int, body string)

Source from the content-addressed store, hash-verified

13)
14
15func extensionHTTPClient(t *testing.T, path string, status int, body string) *http.Client {
16 t.Helper()
17
18 reg := &httpmock.Registry{}
19 t.Cleanup(func() {
20 reg.Verify(t)
21 })
22 reg.Register(
23 httpmock.REST(http.MethodGet, path),
24 httpmock.StatusStringResponse(status, body),
25 )
26 return &http.Client{Transport: reg}
27}
28
29func requireExtensionHTTPError(t *testing.T, err error, status int) {
30 t.Helper()

Callers 4

TestRepoExistsFunction · 0.85
TestHasScriptFunction · 0.85
TestFetchLatestReleaseFunction · 0.85
TestFetchReleaseFromTagFunction · 0.85

Calls 5

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
StatusStringResponseFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected