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

Commit c12996d

Browse files
shvcdashpole
andauthored
refine: the server-side http Request Body is always non-nil (#1291)
* refine: the server-side http Request Body is always non-nil --------- Co-authored-by: David Ashpole <dashpole@google.com>
1 parent 7823041 commit c12996d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugin/ochttp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (h *Handler) startTrace(w http.ResponseWriter, r *http.Request) (*http.Requ
130130
}
131131
}
132132
span.AddAttributes(requestAttrs(r)...)
133-
if r.Body == nil {
133+
if r.Body == nil || r.Body == http.NoBody {
134134
// TODO: Handle cases where ContentLength is not set.
135135
} else if r.ContentLength > 0 {
136136
span.AddMessageReceiveEvent(0, /* TODO: messageID */
@@ -156,7 +156,7 @@ func (h *Handler) startStats(w http.ResponseWriter, r *http.Request) (http.Respo
156156
ctx: ctx,
157157
writer: w,
158158
}
159-
if r.Body == nil {
159+
if r.Body == nil || r.Body == http.NoBody {
160160
// TODO: Handle cases where ContentLength is not set.
161161
track.reqSize = -1
162162
} else if r.ContentLength > 0 {

0 commit comments

Comments
 (0)