Skip to content

Commit

Permalink
fix: (#1410)
Browse files Browse the repository at this point in the history
1. the length of trailer key should > 0
2. fix http_test words typo
  • Loading branch information
byene0923 committed Oct 29, 2022
1 parent e214137 commit eca86de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion header.go
Expand Up @@ -2520,8 +2520,8 @@ func (h *ResponseHeader) parseTrailer(buf []byte) (int, error) {
err = fmt.Errorf("forbidden trailer key %q", s.key)
continue
}
h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue)
}
h.h = appendArgBytes(h.h, s.key, s.value, argsHasValue)
}
if s.err != nil {
return 0, s.err
Expand Down
8 changes: 4 additions & 4 deletions http_test.go
Expand Up @@ -1660,10 +1660,10 @@ func TestRequestReadLimitBody(t *testing.T) {
}

func testResponseReadLimitBodyError(t *testing.T, s string, maxBodySize int, expectedErr error) {
var req Response
var resp Response
r := bytes.NewBufferString(s)
br := bufio.NewReader(r)
err := req.ReadLimitBody(br, maxBodySize)
err := resp.ReadLimitBody(br, maxBodySize)
if err == nil {
t.Fatalf("expecting error. s=%q, maxBodySize=%d", s, maxBodySize)
}
Expand All @@ -1673,10 +1673,10 @@ func testResponseReadLimitBodyError(t *testing.T, s string, maxBodySize int, exp
}

func testResponseReadLimitBodySuccess(t *testing.T, s string, maxBodySize int) {
var req Response
var resp Response
r := bytes.NewBufferString(s)
br := bufio.NewReader(r)
if err := req.ReadLimitBody(br, maxBodySize); err != nil {
if err := resp.ReadLimitBody(br, maxBodySize); err != nil {
t.Fatalf("unexpected error: %v. s=%q, maxBodySize=%d", err, s, maxBodySize)
}
}
Expand Down

0 comments on commit eca86de

Please sign in to comment.