Skip to content

Commit 121e5bb

Browse files
author
shvc
committed
net/http: the server-side http Request Body is always non-nil
For server requests, the Request Body is always non-nil.
1 parent 4ab1aec commit 121e5bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net/http/request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ func (r *Request) multipartReader(allowMixed bool) (*multipart.Reader, error) {
510510
if v == "" {
511511
return nil, ErrNotMultipart
512512
}
513-
if r.Body == nil {
513+
if r.Body == nil || r.Body == NoBody {
514514
return nil, errors.New("missing form body")
515515
}
516516
d, params, err := mime.ParseMediaType(v)
@@ -1261,7 +1261,7 @@ func copyValues(dst, src url.Values) {
12611261
}
12621262

12631263
func parsePostForm(r *Request) (vs url.Values, err error) {
1264-
if r.Body == nil {
1264+
if r.Body == nil || r.Body == NoBody {
12651265
err = errors.New("missing form body")
12661266
return
12671267
}

0 commit comments

Comments
 (0)