MCPcopy Index your code
hub / github.com/github/github-mcp-server / browserGet

Function browserGet

internal/oauth/testutil_test.go:183–196  ·  view source on GitHub ↗

browserGet simulates a user completing the authorization-code flow by opening the URL: it follows the authorize redirect to the local callback, delivering the code to the manager's callback server. Used both as an openURL seam and inside prompter hooks.

(rawurl string)

Source from the content-addressed store, hash-verified

181// the code to the manager's callback server. Used both as an openURL seam and
182// inside prompter hooks.
183func browserGet(rawurl string) error {
184 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
185 defer cancel()
186 req, err := http.NewRequestWithContext(ctx, http.MethodGet, rawurl, nil)
187 if err != nil {
188 return err
189 }
190 resp, err := http.DefaultClient.Do(req)
191 if err != nil {
192 return err
193 }
194 _, _ = io.Copy(io.Discard, resp.Body)
195 return resp.Body.Close()
196}
197
198func testLogger() *slog.Logger {
199 return slog.New(slog.NewTextHandler(io.Discard, nil))

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected