Skip to content

Commit

Permalink
Fix: remove duplicate response body read
Browse files Browse the repository at this point in the history
  • Loading branch information
rwos committed Feb 12, 2024
1 parent f016a91 commit 76f3fa0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 1 addition & 0 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestRateLimit(t *testing.T) {
if rateLimitHits > 0 {
rateLimitHits -= 1
w.WriteHeader(http.StatusTooManyRequests)
//nolint:errcheck
w.Write([]byte(`{
"status": 429,
"error": "Too Many Requests",
Expand Down
8 changes: 0 additions & 8 deletions invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ package golexoffice
import (
"bytes"
"encoding/json"
"fmt"
"io"
)

// InvoiceBody is to define body data
Expand Down Expand Up @@ -134,12 +132,6 @@ func (c *Config) Invoice(id string) (InvoiceBody, error) {
// Close request
defer response.Body.Close()

read, err := io.ReadAll(response.Body)
if err != nil {
return InvoiceBody{}, err
}
fmt.Println(string(read))

// Decode data
var decode InvoiceBody

Expand Down

0 comments on commit 76f3fa0

Please sign in to comment.