Skip to content

Commit

Permalink
chore: include io.ReadAll generation updates only
Browse files Browse the repository at this point in the history
  • Loading branch information
burkedavison committed Jul 2, 2024
1 parent c3f335d commit 2de9f83
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 72 deletions.
16 changes: 8 additions & 8 deletions server/genrest/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (backend *RESTBackend) HandleRepeatDataBody(w http.ResponseWriter, r *http.
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -130,8 +130,8 @@ func (backend *RESTBackend) HandleRepeatDataBodyInfo(w http.ResponseWriter, r *h
var bodyField genprotopb.ComplianceData
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -537,8 +537,8 @@ func (backend *RESTBackend) HandleRepeatDataBodyPut(w http.ResponseWriter, r *ht
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -611,8 +611,8 @@ func (backend *RESTBackend) HandleRepeatDataBodyPatch(w http.ResponseWriter, r *
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
32 changes: 16 additions & 16 deletions server/genrest/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (backend *RESTBackend) HandleEcho(w http.ResponseWriter, r *http.Request) {
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -129,8 +129,8 @@ func (backend *RESTBackend) HandleEchoErrorDetails(w http.ResponseWriter, r *htt
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -203,8 +203,8 @@ func (backend *RESTBackend) HandleExpand(w http.ResponseWriter, r *http.Request)
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -280,8 +280,8 @@ func (backend *RESTBackend) HandlePagedExpand(w http.ResponseWriter, r *http.Req
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -354,8 +354,8 @@ func (backend *RESTBackend) HandlePagedExpandLegacy(w http.ResponseWriter, r *ht
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -428,8 +428,8 @@ func (backend *RESTBackend) HandlePagedExpandLegacyMapped(w http.ResponseWriter,
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -502,8 +502,8 @@ func (backend *RESTBackend) HandleWait(w http.ResponseWriter, r *http.Request) {
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -576,8 +576,8 @@ func (backend *RESTBackend) HandleBlock(w http.ResponseWriter, r *http.Request)
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
32 changes: 16 additions & 16 deletions server/genrest/iampolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (backend *RESTBackend) HandleSetIamPolicy(w http.ResponseWriter, r *http.Re
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -129,8 +129,8 @@ func (backend *RESTBackend) HandleSetIamPolicy_1(w http.ResponseWriter, r *http.
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -203,8 +203,8 @@ func (backend *RESTBackend) HandleSetIamPolicy_2(w http.ResponseWriter, r *http.
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -277,8 +277,8 @@ func (backend *RESTBackend) HandleSetIamPolicy_3(w http.ResponseWriter, r *http.
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -615,8 +615,8 @@ func (backend *RESTBackend) HandleTestIamPermissions(w http.ResponseWriter, r *h
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -689,8 +689,8 @@ func (backend *RESTBackend) HandleTestIamPermissions_1(w http.ResponseWriter, r
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -763,8 +763,8 @@ func (backend *RESTBackend) HandleTestIamPermissions_2(w http.ResponseWriter, r
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -837,8 +837,8 @@ func (backend *RESTBackend) HandleTestIamPermissions_3(w http.ResponseWriter, r
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
8 changes: 4 additions & 4 deletions server/genrest/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (backend *RESTBackend) HandleCreateUser(w http.ResponseWriter, r *http.Requ
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -196,8 +196,8 @@ func (backend *RESTBackend) HandleUpdateUser(w http.ResponseWriter, r *http.Requ
var bodyField genprotopb.User
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
36 changes: 18 additions & 18 deletions server/genrest/messaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (backend *RESTBackend) HandleCreateRoom(w http.ResponseWriter, r *http.Requ
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -196,8 +196,8 @@ func (backend *RESTBackend) HandleUpdateRoom(w http.ResponseWriter, r *http.Requ
var bodyField genprotopb.Room
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -405,8 +405,8 @@ func (backend *RESTBackend) HandleCreateBlurb(w http.ResponseWriter, r *http.Req
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -479,8 +479,8 @@ func (backend *RESTBackend) HandleCreateBlurb_1(w http.ResponseWriter, r *http.R
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -686,8 +686,8 @@ func (backend *RESTBackend) HandleUpdateBlurb(w http.ResponseWriter, r *http.Req
var bodyField genprotopb.Blurb
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -769,8 +769,8 @@ func (backend *RESTBackend) HandleUpdateBlurb_1(w http.ResponseWriter, r *http.R
var bodyField genprotopb.Blurb
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -1115,8 +1115,8 @@ func (backend *RESTBackend) HandleSearchBlurbs(w http.ResponseWriter, r *http.Re
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -1255,8 +1255,8 @@ func (backend *RESTBackend) HandleStreamBlurbs(w http.ResponseWriter, r *http.Re
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -1325,8 +1325,8 @@ func (backend *RESTBackend) HandleStreamBlurbs_1(w http.ResponseWriter, r *http.
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
16 changes: 8 additions & 8 deletions server/genrest/sequenceservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (backend *RESTBackend) HandleCreateSequence(w http.ResponseWriter, r *http.
var bodyField genprotopb.Sequence
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -139,8 +139,8 @@ func (backend *RESTBackend) HandleCreateStreamingSequence(w http.ResponseWriter,
var bodyField genprotopb.StreamingSequence
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -353,8 +353,8 @@ func (backend *RESTBackend) HandleAttemptSequence(w http.ResponseWriter, r *http
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down Expand Up @@ -427,8 +427,8 @@ func (backend *RESTBackend) HandleAttemptStreamingSequence(w http.ResponseWriter
// Intentional: Field values in the URL path override those set in the body.
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down
4 changes: 2 additions & 2 deletions server/genrest/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (backend *RESTBackend) HandleCreateSession(w http.ResponseWriter, r *http.R
var bodyField genprotopb.Session
var jsonReader bytes.Buffer
bodyReader := io.TeeReader(r.Body, &jsonReader)
rBytes := make([]byte, r.ContentLength)
if _, err := bodyReader.Read(rBytes); err != nil && err != io.EOF {
rBytes, err := io.ReadAll(bodyReader)
if err != nil && err != io.EOF {
backend.Error(w, http.StatusBadRequest, "error reading body content: %s", err)
return
}
Expand Down

0 comments on commit 2de9f83

Please sign in to comment.