Skip to content

Commit

Permalink
other edge case of unknown host
Browse files Browse the repository at this point in the history
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
  • Loading branch information
onelapahead committed Dec 20, 2024
1 parent 052c797 commit 8180cc5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/ffresty/ffresty.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"strings"
"time"

"github.com/go-resty/resty/v2"
"github.com/hyperledger/firefly-common/pkg/config"
"github.com/hyperledger/firefly-common/pkg/ffapi"
"github.com/hyperledger/firefly-common/pkg/fftypes"
Expand Down Expand Up @@ -249,8 +248,8 @@ func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Cli

client.SetTimeout(time.Duration(ffrestyConfig.HTTPRequestTimeout))

client.OnBeforeRequest(func(_ *resty.Client, req *resty.Request) error {
if rateLimiterMap[client] != nil {
client.OnBeforeRequest(func(c *resty.Client, req *resty.Request) error {
if rateLimiter != nil {
// Wait for permission to proceed with the request
err := rateLimiterMap[client].Wait(req.Context())
if err != nil {
Expand All @@ -269,6 +268,9 @@ func NewWithConfig(ctx context.Context, ffrestyConfig Config) (client *resty.Cli
if u == nil && _url != "" {
u, _ = url.Parse(_url)
}
if u == nil && c.BaseURL != "" {
u, _ = url.Parse(c.BaseURL)
}
if u != nil && u.Host != "" {
host := u.Host
rCtx = context.WithValue(rCtx, hostCtxKey{}, host)
Expand Down

0 comments on commit 8180cc5

Please sign in to comment.