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

Function extensionHTTPClient

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

Source from the content-addressed store, hash-verified

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

Callers 5

TestRepoExistsFunction · 0.85
TestHasScriptFunction · 0.85
TestFetchLatestReleaseFunction · 0.85
TestFetchReleaseFromTagFunction · 0.85
TestFetchCommitSHAFunction · 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