MCPcopy Index your code
hub / github.com/google/go-github / TestClientCopy_leak_transport

Function TestClientCopy_leak_transport

github/github_test.go:4502–4533  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4500}
4501
4502func TestClientCopy_leak_transport(t *testing.T) {
4503 t.Parallel()
4504 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
4505 w.Header().Set("Content-Type", "application/json")
4506 accessToken := r.Header.Get("Authorization")
4507 _, _ = fmt.Fprintf(w, `{"login": "%v"}`, accessToken)
4508 }))
4509 clientPreconfiguredWithURLs := mustNewClient(t, WithURLs(&srv.URL, &srv.URL))
4510
4511 aliceClient, err := clientPreconfiguredWithURLs.Clone(WithAuthToken("alice"))
4512 if err != nil {
4513 t.Fatal(err)
4514 }
4515 bobClient, err := clientPreconfiguredWithURLs.Clone(WithAuthToken("bob"))
4516 if err != nil {
4517 t.Fatal(err)
4518 }
4519
4520 alice, _, err := aliceClient.Users.Get(t.Context(), "")
4521 if err != nil {
4522 t.Fatal(err)
4523 }
4524
4525 assertNoDiff(t, "Bearer alice", alice.GetLogin())
4526
4527 bob, _, err := bobClient.Users.Get(t.Context(), "")
4528 if err != nil {
4529 t.Fatal(err)
4530 }
4531
4532 assertNoDiff(t, "Bearer bob", bob.GetLogin())
4533}
4534
4535func TestPtr(t *testing.T) {
4536 t.Parallel()

Callers

nothing calls this directly

Calls 7

mustNewClientFunction · 0.85
WithURLsFunction · 0.85
WithAuthTokenFunction · 0.85
assertNoDiffFunction · 0.85
CloneMethod · 0.80
GetMethod · 0.45
GetLoginMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…