MCPcopy Index your code
hub / github.com/larksuite/cli / TestNewHTTPClient

Function TestNewHTTPClient

internal/transport/shared_test.go:93–109  ·  view source on GitHub ↗

TestNewHTTPClient verifies the factory wires the shared proxy-plugin-aware transport (instead of a bare client that bypasses proxy plugin mode).

(t *testing.T)

Source from the content-addressed store, hash-verified

91// TestNewHTTPClient verifies the factory wires the shared proxy-plugin-aware
92// transport (instead of a bare client that bypasses proxy plugin mode).
93func 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.

Callers

nothing calls this directly

Calls 4

unsetProxyPluginEnvFunction · 0.85
resetProxyPluginStateFunction · 0.85
NewHTTPClientFunction · 0.85
SharedFunction · 0.85

Tested by

no test coverage detected