aboutsummaryrefslogtreecommitdiff
path: root/server_test.go
diff options
context:
space:
mode:
authorGravatar Oleksandr Redko <oleksandr.red+github@gmail.com> 2023-03-06 12:13:37 +0200
committerGravatar GitHub <noreply@github.com> 2023-03-06 11:13:37 +0100
commit4ca6994c93983054ad9c82789844de77a04f6dd5 (patch)
tree3f1e6ef636f1bb7cdc536014a1a51194752bd448 /server_test.go
parentImmediately return ErrTimeout if deadline is already reached. (#1497) (diff)
downloadfasthttp-4ca6994c93983054ad9c82789844de77a04f6dd5.tar.gz
fasthttp-4ca6994c93983054ad9c82789844de77a04f6dd5.tar.bz2
fasthttp-4ca6994c93983054ad9c82789844de77a04f6dd5.zip
test: use Fprintf to simplify writing headers (#1510)
Diffstat (limited to 'server_test.go')
-rw-r--r--server_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/server_test.go b/server_test.go
index eef3c2c..62e6eec 100644
--- a/server_test.go
+++ b/server_test.go
@@ -3772,7 +3772,7 @@ func TestStreamRequestBody(t *testing.T) {
pipe := fasthttputil.NewPipeConns()
cc, sc := pipe.Conn1(), pipe.Conn2()
// write headers and part1 body
- if _, err := cc.Write([]byte(fmt.Sprintf("POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n", contentLength))); err != nil {
+ if _, err := fmt.Fprintf(cc, "POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n", contentLength); err != nil {
t.Fatal(err)
}
if _, err := cc.Write([]byte(part1)); err != nil {
@@ -3829,7 +3829,7 @@ func TestStreamRequestBodyExceedMaxSize(t *testing.T) {
pipe := fasthttputil.NewPipeConns()
cc, sc := pipe.Conn1(), pipe.Conn2()
// write headers and part1 body
- if _, err := cc.Write([]byte(fmt.Sprintf("POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n%s", contentLength, part1))); err != nil {
+ if _, err := fmt.Fprintf(cc, "POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n%s", contentLength, part1); err != nil {
t.Error(err)
}
@@ -3876,7 +3876,7 @@ func TestStreamBodyRequestContentLength(t *testing.T) {
pipe := fasthttputil.NewPipeConns()
cc, sc := pipe.Conn1(), pipe.Conn2()
- if _, err := cc.Write([]byte(fmt.Sprintf("POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n%s", contentLength, content))); err != nil {
+ if _, err := fmt.Fprintf(cc, "POST /foo2 HTTP/1.1\r\nHost: aaa.com\r\nContent-Length: %d\r\nContent-Type: aa\r\n\r\n%s", contentLength, content); err != nil {
t.Fatal(err)
}