diff --git a/.gitignore b/.gitignore index 4d110c6796..df53ec1942 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tags *.fasthttp.br .idea .DS_Store +vendor/ diff --git a/status.go b/status.go index 1746c01dc1..9d599270f9 100644 --- a/status.go +++ b/status.go @@ -2,6 +2,7 @@ package fasthttp import ( "fmt" + "strconv" ) const ( @@ -181,5 +182,12 @@ func statusLine(statusCode int) []byte { func invalidStatusLine(statusCode int) []byte { statusText := StatusMessage(statusCode) - return []byte(fmt.Sprintf("HTTP/1.1 %d %s\r\n", statusCode, statusText)) + // xxx placeholder of status code + var line = make([]byte, 0, len("HTTP/1.1 xxx \r\n")+len(statusText)) + line = append(line, []byte("HTTP/1.1 ")...) + line = strconv.AppendInt(line, int64(statusCode), 10) + line = append(line, []byte(" ")...) + line = append(line, []byte(statusText)...) + line = append(line, []byte("\r\n")...) + return line }