Skip to content

Commit

Permalink
chore: close response if response code is different
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr committed Feb 9, 2024
1 parent c19d7c4 commit 843c2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/clients/base/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"io"
"net/http"
"net/url"

"github.com/rudderlabs/rudder-go-kit/httputil"
)

type Client struct {
Expand Down Expand Up @@ -36,7 +38,9 @@ func (c *Client) Send(req *http.Request) ([]byte, error) {
if err != nil {
return nil, err
}
defer res.Body.Close()
defer func() {
httputil.CloseResponse(res)
}()

if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code: %d", res.StatusCode)
Expand Down
3 changes: 1 addition & 2 deletions sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ func (cp *ControlPlane) GetWorkspaceConfigs() (*modelv2.WorkspaceConfigs, error)
}
}

// GetRawWorkspaceConfigs returns the raw workspace configs.
// Currently, it does not support for incremental updates.
// GetRawWorkspaceConfigs returns the raw workspace configs. It does not support for incremental updates.
func (cp *ControlPlane) GetRawWorkspaceConfigs() ([]byte, error) {
return cp.Client.GetRawWorkspaceConfigs(context.Background())
}
Expand Down

0 comments on commit 843c2b9

Please sign in to comment.