Skip to content

Commit

Permalink
Use io.ReadAll (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohkinozomu authored Nov 21, 2023
1 parent 3a4fbaa commit 6c4b603
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/hub/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"math/rand"
"net/http"
"net/url"
Expand Down Expand Up @@ -320,8 +321,7 @@ func (s *server) handleRequest(w http.ResponseWriter, r *http.Request) {
}
s.bus.RegisterHandler(uuid, handler)

bodyBytes := make([]byte, r.ContentLength)
r.Body.Read(bodyBytes)
bodyBytes, err := io.ReadAll(r.Body)

if s.encoder != nil {
bodyBytes = s.encoder.EncodeAll(bodyBytes, nil)
Expand Down

0 comments on commit 6c4b603

Please sign in to comment.