Skip to content

Commit

Permalink
Merge pull request #50 from crimike/main
Browse files Browse the repository at this point in the history
fix: read request body to EOF so that the connection may be reused
  • Loading branch information
ddlees authored Sep 1, 2023
2 parents a6a603c + 32c61fe commit c8ea1a5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions client/rest/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (

func Decode(body io.ReadCloser, v interface{}) error {
defer body.Close()
defer io.ReadAll(body) // must read all; streaming to the json decoder does not read to EOF making the connection unavailable for reuse
return json.NewDecoder(body).Decode(v)
}

Expand Down

0 comments on commit c8ea1a5

Please sign in to comment.