Skip to content

Commit

Permalink
Merge pull request #43 from aryala7/CloseResponseBody
Browse files Browse the repository at this point in the history
Close response body
  • Loading branch information
Ja7ad authored Apr 11, 2024
2 parents 87f123c + 9739287 commit dd0f5e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"bytes"
"context"
"encoding/json"
"github.com/go-playground/validator/v10"
"golang.org/x/time/rate"
"net/http"
"net/url"

"github.com/go-playground/validator/v10"
"golang.org/x/time/rate"
)

var _ Transporter = (*Client)(nil)
Expand Down Expand Up @@ -78,7 +79,7 @@ func (c *Client) Get(ctx context.Context, apiConfig *APIConfig) (*Response, erro
if err != nil {
return nil, err
}

defer resp.Body.Close()
return &Response{resp}, nil
}

Expand Down Expand Up @@ -117,7 +118,7 @@ func (c *Client) Post(ctx context.Context, apiConfig *APIConfig, apiRequest any)
if err != nil {
return nil, err
}

defer resp.Body.Close()
return &Response{resp}, nil
}

Expand Down

0 comments on commit dd0f5e7

Please sign in to comment.