Skip to content

Commit

Permalink
Fixing merge conflicts
Browse files Browse the repository at this point in the history
Issue: #1132
  • Loading branch information
uwaterloo gitlab committed Oct 24, 2021
1 parent 58d6b41 commit f59a132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion header.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (h *ResponseHeader) Protocol() []byte {
if len(h.protocol) > 0 {
return h.protocol
}
return httpHeader
return strHTTP11
}

// SetProtocol sets response protocol bytes.
Expand Down Expand Up @@ -712,6 +712,7 @@ func (h *ResponseHeader) resetSkipNormalize() {

h.statusCode = 0
h.statusMessage = h.statusMessage[:0]
h.protocol = h.protocol[:0]
h.contentLength = 0
h.contentLengthBytes = h.contentLengthBytes[:0]

Expand Down Expand Up @@ -761,6 +762,7 @@ func (h *ResponseHeader) CopyTo(dst *ResponseHeader) {

dst.statusCode = h.statusCode
dst.statusMessage = append(dst.statusMessage[:0], h.statusMessage...)
dst.protocol = append(dst.protocol[:0], h.protocol...)
dst.contentLength = h.contentLength
dst.contentLengthBytes = append(dst.contentLengthBytes, h.contentLengthBytes...)
dst.contentType = append(dst.contentType, h.contentType...)
Expand Down
6 changes: 3 additions & 3 deletions header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func TestResponseHeaderMultiLineValue(t *testing.T) {
t.Errorf("parse protocol with non-default value failed, got: %s want: HTTP/3.3", header.Protocol())
}

if !bytes.Equal(header.appendStatusLine([]byte{}), []byte("HTTP/3.3 200 SuperOK\r\n")) {
if !bytes.Equal(header.AppendStatusLine([]byte{}), []byte("HTTP/3.3 200 SuperOK\r\n")) {
t.Errorf("parse status line with non-default value failed, got: %s want: HTTP/3.3 200 SuperOK", header.Protocol())
}

header.SetStatusMessage(nil)

if !bytes.Equal(header.appendStatusLine([]byte{}), []byte("HTTP/3.3 200 OK\r\n")) {
if !bytes.Equal(header.AppendStatusLine([]byte{}), []byte("HTTP/3.3 200 OK\r\n")) {
t.Errorf("parse status line with default protocol value failed, got: %s want: HTTP/3.3 200 OK", header.Protocol())
}

Expand Down Expand Up @@ -106,7 +106,7 @@ func TestResponseHeaderMultiLineName(t *testing.T) {
t.Errorf("expected default protocol, got: %s", header.Protocol())
}

if !bytes.Equal(header.appendStatusLine([]byte{}), []byte("HTTP/1.1 200 OK\r\n")) {
if !bytes.Equal(header.AppendStatusLine([]byte{}), []byte("HTTP/1.1 200 OK\r\n")) {
t.Errorf("parse status line with non-default value failed, got: %s want: HTTP/1.1 200 OK", header.Protocol())
}
}
Expand Down

0 comments on commit f59a132

Please sign in to comment.