Skip to content

Commit

Permalink
fix: read body as string
Browse files Browse the repository at this point in the history
  • Loading branch information
eynopv committed Aug 25, 2024
1 parent 29141d4 commit 24697b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package client

import (
"bytes"
"io"
"net/http"
"strings"
"time"

"github.com/eynopv/lac/pkg/request"
Expand All @@ -21,7 +21,8 @@ func (c *Client) Do(r *request.Request) (*result.Result, error) {
)

if len(r.Body) != 0 {
bodyReader := bytes.NewReader(r.Body)
bodyStr := strings.Trim(strings.TrimSpace(string(r.Body)), `"`)
bodyReader := strings.NewReader(bodyStr)
request, err = http.NewRequest(r.Method, r.Path, bodyReader)
} else {
request, err = http.NewRequest(r.Method, r.Path, nil)
Expand Down

0 comments on commit 24697b4

Please sign in to comment.