Skip to content

Commit

Permalink
fix(datastore): content-type: octet-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-pad committed Apr 26, 2024
1 parent 3a144ee commit 9fe58a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/datastore/api/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (a *API) PutLogsHandler(c echo.Context) error {
if err != nil {
return c.String(http.StatusBadRequest, err.Error())
}
_, err = c.Request().Body.Read(content)
c.Bind(&content)

Check failure on line 60 in internal/datastore/api/logs.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `c.Bind` is not checked (errcheck)
if err != nil {
return c.String(http.StatusBadRequest, "could not read request body: "+err.Error())
}
Expand Down
3 changes: 1 addition & 2 deletions internal/datastore/api/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ func (a *API) PutPlanHandler(c echo.Context) error {
if attempt == "" || format == "" {
return c.String(http.StatusBadRequest, "missing query parameters")
}

_, err = c.Request().Body.Read(content)
c.Bind(&content)

Check failure on line 57 in internal/datastore/api/plans.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `c.Bind` is not checked (errcheck)
if err != nil {
return c.String(http.StatusBadRequest, "could not read request body: "+err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/datastore/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *DefaultClient) PutPlan(namespace string, layer string, run string, atte
http.MethodPut,
bytes.NewBuffer(content),
)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Type", "application/octet-stream")
if err != nil {
return err
}
Expand Down Expand Up @@ -183,7 +183,7 @@ func (c *DefaultClient) PutLogs(namespace string, layer string, run string, atte
http.MethodPut,
bytes.NewBuffer(content),
)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Type", "application/octet-stream")
if err != nil {
return err
}
Expand Down

0 comments on commit 9fe58a1

Please sign in to comment.