MCPcopy Create free account
hub / github.com/basecamp/hey-cli / initSDK

Function initSDK

internal/cmd/sdk.go:60–78  ·  view source on GitHub ↗

initSDK creates the SDK client, bridging the CLI's auth and config.

(authMgr *auth.Manager, baseURL string)

Source from the content-addressed store, hash-verified

58
59// initSDK creates the SDK client, bridging the CLI's auth and config.
60func initSDK(authMgr *auth.Manager, baseURL string) {
61 sdkCfg := &hey.Config{
62 BaseURL: baseURL,
63 CacheEnabled: false,
64 }
65
66 var opts []hey.ClientOption
67 opts = append(opts, hey.WithAuthStrategy(&cliAuthStrategy{mgr: authMgr}))
68 opts = append(opts, hey.WithUserAgent(version.UserAgent()+" "+hey.DefaultUserAgent))
69
70 if verboseFlag > 0 {
71 opts = append(opts, hey.WithLogger(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))))
72 }
73
74 sdkStats = &statsHooks{}
75 opts = append(opts, hey.WithHooks(sdkStats))
76
77 sdk = hey.NewClient(sdkCfg, nil, opts...)
78}
79
80// convertSDKError maps hey.Error to apierr.Error for CLI error display.
81func convertSDKError(err error) error {

Callers 1

newRootCmdFunction · 0.85

Calls 1

UserAgentFunction · 0.92

Tested by

no test coverage detected