Use Custom HTTP Clients

SDK users can provide a custom HTTP client when initializing SDKs. This is useful for modifying or debugging requests and responses in flight.

See below for per-language examples:

The Go SDK will accept a client that implements a Do(*http.Request) (*http.Response, error) method similar to the standard library's http.Client.


// A custom HTTP client that implements caching
c := NewCachedClient(&http.Client{}, cache)
opts := []sdk.SDKOption{
sdk.WithClient(c),
}
s := sdk.New(opts)