summaryrefslogtreecommitdiff
path: root/service/http/handler_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-13 13:25:57 +0300
committerWolfy-J <[email protected]>2018-06-13 13:25:57 +0300
commit8b24183daa620bb12edf78f6e81697532cbc92d8 (patch)
tree8f05a885ccacfdb1d26a918a1f39ef6ad03a3f35 /service/http/handler_test.go
parent142f5e61397811ea83da9989c312e929a291e590 (diff)
more tests
Diffstat (limited to 'service/http/handler_test.go')
-rw-r--r--service/http/handler_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/service/http/handler_test.go b/service/http/handler_test.go
index c7b38ee2..560b9c1b 100644
--- a/service/http/handler_test.go
+++ b/service/http/handler_test.go
@@ -12,6 +12,7 @@ import (
"context"
"bytes"
"mime/multipart"
+ "time"
)
// get request and return body
@@ -281,6 +282,7 @@ func TestServer_JsonPayload_PATCH(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
req, err := http.NewRequest(
"PATCH",
@@ -330,6 +332,7 @@ func TestServer_FormData_POST(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
form := url.Values{}
@@ -391,6 +394,7 @@ func TestServer_FormData_PUT(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
form := url.Values{}
@@ -452,6 +456,7 @@ func TestServer_FormData_PATCH(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
form := url.Values{}
@@ -513,6 +518,7 @@ func TestServer_Multipart_POST(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
var mb bytes.Buffer
w := multipart.NewWriter(&mb)
@@ -578,6 +584,7 @@ func TestServer_Multipart_PUT(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
var mb bytes.Buffer
w := multipart.NewWriter(&mb)
@@ -639,10 +646,11 @@ func TestServer_Multipart_PATCH(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8020", Handler: st,}
+ hs := &http.Server{Addr: ":8021", Handler: st,}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
var mb bytes.Buffer
w := multipart.NewWriter(&mb)