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

Method Get

pkg/cmd/attestation/api/mock_httpClient_test.go:68–90  ·  view source on GitHub ↗
(url string)

Source from the content-addressed store, hash-verified

66}
67
68func (m *failAfterNCallsHttpClient) Get(url string) (*http.Response, error) {
69 m.mu.Lock()
70 defer m.mu.Unlock()
71
72 m.On("OnGetFailAfterNCalls").Return()
73
74 m.NumCalls++
75
76 if m.NumCalls == m.FailOnCallN || (m.NumCalls > m.FailOnCallN && m.FailOnAllSubsequentCalls) {
77 m.MethodCalled("OnGetFailAfterNCalls")
78 return &http.Response{
79 StatusCode: 500,
80 }, nil
81 }
82
83 m.MethodCalled("OnGetFailAfterNCalls")
84 var compressed []byte
85 compressed = snappy.Encode(compressed, data.SigstoreBundleRaw)
86 return &http.Response{
87 StatusCode: 200,
88 Body: io.NopCloser(bytes.NewReader(compressed)),
89 }, nil
90}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected