openfga / sdk-generator

OpenFGA Client SDK Generator
Apache License 2.0
14 stars 30 forks source link

[Go SDK] The HTTP Client in the Go SDK cannot be configurable #370

Closed wonyx closed 1 month ago

wonyx commented 1 month ago

Checklist

Description

The HTTP Client in the Go SDK cannot be configurable. Although there is a HTTPClient field in the ClientConfiguration, it seems that the value is not being set.

Expectation

The HTTP Client should be configurable in the Go SDK.

Reproduction

Here is an example of changing the HTTP client to a custom HTTP client of OTel:

import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"

cli := &http.Client{
    Transport: otelhttp.NewTransport(http.DefaultTransport),
}
fgaClient, err := client.NewSdkClient(&client.ClientConfiguration{
    ApiScheme:            cfg.ApiScheme,
    ApiHost:              cfg.ApiHost,
    StoreId:              cfg.StoreId,
    AuthorizationModelId: cfg.AuthorizationModelId,
    HTTPClient:           cli,
})

SDK Checklist

OpenFGA SDK version

0.4.0

OpenFGA version

1.5.3

SDK Configuration

env var

Logs

No response

References

No response