From 9e252ee90db5549d910d46dd998fd499dac60b22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:03:02 +0000 Subject: [PATCH] fix(client): no panic on missing BaseURL (#121) --- internal/requestconfig/requestconfig.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 62e7956..1e46193 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -301,6 +301,10 @@ func retryDelay(res *http.Response, retryCount int) time.Duration { } func (cfg *RequestConfig) Execute() (err error) { + if cfg.BaseURL == nil { + return fmt.Errorf("requestconfig: base url is not set") + } + cfg.Request.URL, err = cfg.BaseURL.Parse(strings.TrimLeft(cfg.Request.URL.String(), "/")) if err != nil { return err