Skip to content

Commit

Permalink
optimize: allow http head when use getonly
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jin-gou committed Dec 21, 2022
1 parent 2a572e0 commit d38858f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ func (req *Request) readLimitBody(r *bufio.Reader, maxBodySize int, getOnly bool
// Do not reset the request here - the caller must reset it before
// calling this method.

if getOnly && !req.Header.IsGet() {
if getOnly && !req.Header.IsGet() && !req.Header.IsHead() {
return ErrGetOnly
}

Expand All @@ -1147,7 +1147,7 @@ func (req *Request) readBodyStream(r *bufio.Reader, maxBodySize int, getOnly boo
// Do not reset the request here - the caller must reset it before
// calling this method.

if getOnly && !req.Header.IsGet() {
if getOnly && !req.Header.IsGet() && !req.Header.IsHead() {
return ErrGetOnly
}

Expand Down

0 comments on commit d38858f

Please sign in to comment.