TestNewHTTPClient verifies the factory wires the shared proxy-plugin-aware transport (instead of a bare client that bypasses proxy plugin mode).
(t *testing.T)
| 91 | // TestNewHTTPClient verifies the factory wires the shared proxy-plugin-aware |
| 92 | // transport (instead of a bare client that bypasses proxy plugin mode). |
| 93 | func TestNewHTTPClient(t *testing.T) { |
| 94 | t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) |
| 95 | unsetProxyPluginEnv(t) |
| 96 | resetProxyPluginState() |
| 97 | t.Setenv(EnvNoProxy, "") |
| 98 | |
| 99 | c := NewHTTPClient(7 * time.Second) |
| 100 | if c.Transport == nil { |
| 101 | t.Fatal("NewHTTPClient transport is nil; want shared transport") |
| 102 | } |
| 103 | if c.Transport != Shared() { |
| 104 | t.Errorf("NewHTTPClient transport = %v, want Shared()", c.Transport) |
| 105 | } |
| 106 | if c.Timeout != 7*time.Second { |
| 107 | t.Errorf("NewHTTPClient timeout = %v, want 7s", c.Timeout) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // TestShared_PluginOverridesNoProxy locks the contract that proxy-plugin mode wins |
| 112 | // over LARK_CLI_NO_PROXY: even with NO_PROXY set, an enabled plugin forces the proxy. |
nothing calls this directly
no test coverage detected