(t *testing.T)
| 4500 | } |
| 4501 | |
| 4502 | func 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 | |
| 4535 | func TestPtr(t *testing.T) { |
| 4536 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…