Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
refine: the server-side http Request Body is always non-nil (#1291)
Browse files Browse the repository at this point in the history
* refine: the server-side http Request Body is always non-nil
---------

Co-authored-by: David Ashpole <dashpole@google.com>
  • Loading branch information
shvc and dashpole committed Feb 22, 2023
1 parent 7823041 commit c12996d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/ochttp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (h *Handler) startTrace(w http.ResponseWriter, r *http.Request) (*http.Requ
}
}
span.AddAttributes(requestAttrs(r)...)
if r.Body == nil {
if r.Body == nil || r.Body == http.NoBody {
// TODO: Handle cases where ContentLength is not set.
} else if r.ContentLength > 0 {
span.AddMessageReceiveEvent(0, /* TODO: messageID */
Expand All @@ -156,7 +156,7 @@ func (h *Handler) startStats(w http.ResponseWriter, r *http.Request) (http.Respo
ctx: ctx,
writer: w,
}
if r.Body == nil {
if r.Body == nil || r.Body == http.NoBody {
// TODO: Handle cases where ContentLength is not set.
track.reqSize = -1
} else if r.ContentLength > 0 {
Expand Down

0 comments on commit c12996d

Please sign in to comment.