MCPcopy
hub / github.com/cli/cli / StatusScopesResponder

Function StatusScopesResponder

pkg/httpmock/stub.go:257–268  ·  view source on GitHub ↗

StatusScopesResponder returns a response with the given status code and OAuth scopes.

(status int, scopes string)

Source from the content-addressed store, hash-verified

255
256// StatusScopesResponder returns a response with the given status code and OAuth scopes.
257func StatusScopesResponder(status int, scopes string) func(*http.Request) (*http.Response, error) {
258 return func(req *http.Request) (*http.Response, error) {
259 return &http.Response{
260 StatusCode: status,
261 Request: req,
262 Header: map[string][]string{
263 "X-Oauth-Scopes": {scopes},
264 },
265 Body: io.NopCloser(bytes.NewBufferString("")),
266 }, nil
267 }
268}
269
270func httpResponse(status int, req *http.Request, body io.Reader) *http.Response {
271 return httpResponseWithHeader(status, req, body, http.Header{})

Callers 2

Test_createRunFunction · 0.92
ScopesResponderFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_createRunFunction · 0.74