From 4066413b18326bdfac1451e07bf5f9237c8b5f47 Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 26 Apr 2024 09:50:52 +0200 Subject: [PATCH] fix(datastore): could not read body --- internal/datastore/client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/datastore/client/client.go b/internal/datastore/client/client.go index 2ec09960..e73d14d8 100644 --- a/internal/datastore/client/client.go +++ b/internal/datastore/client/client.go @@ -1,6 +1,7 @@ package client import ( + "bytes" "crypto/tls" "encoding/json" "fmt" @@ -8,7 +9,6 @@ import ( "net/http" "net/url" "os" - "strings" "github.com/padok-team/burrito/internal/datastore/api" storageerrors "github.com/padok-team/burrito/internal/datastore/storage/error" @@ -119,7 +119,7 @@ func (c *DefaultClient) PutPlan(namespace string, layer string, run string, atte "format": {format}, }, http.MethodPut, - strings.NewReader(string(body)), + bytes.NewBuffer(body), ) req.Header.Set("Content-Type", "application/json") if err != nil { @@ -200,7 +200,7 @@ func (c *DefaultClient) PutLogs(namespace string, layer string, run string, atte "/api/logs", queryParams, http.MethodPut, - strings.NewReader(string(body)), + bytes.NewBuffer(body), ) req.Header.Set("Content-Type", "application/json") if err != nil {