summaryrefslogtreecommitdiff
path: root/service/http/handler_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-13 14:16:57 +0300
committerWolfy-J <[email protected]>2018-06-13 14:16:57 +0300
commit2848bdb1f72395340f9702f6614073a50b35fe2d (patch)
treeb3a0ed8906f1542150fd8ab3da3eed9370ba669b /service/http/handler_test.go
parent01fc3e51ccc02c94630b59073b5597ccac590bfb (diff)
fix service
Diffstat (limited to 'service/http/handler_test.go')
-rw-r--r--service/http/handler_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/service/http/handler_test.go b/service/http/handler_test.go
index 6cc9aeb1..0e236df0 100644
--- a/service/http/handler_test.go
+++ b/service/http/handler_test.go
@@ -54,6 +54,7 @@ func TestServer_Echo(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
body, r, err := get("http://localhost:8077/?hello=world")
assert.NoError(t, err)
@@ -88,6 +89,7 @@ func TestServer_Headers(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
req, err := http.NewRequest("GET", "http://localhost:8078?hello=world", nil)
assert.NoError(t, err)
@@ -134,6 +136,7 @@ func TestServer_Cookies(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
req, err := http.NewRequest("GET", "http://localhost:8079", nil)
assert.NoError(t, err)
@@ -184,6 +187,7 @@ func TestServer_JsonPayload_POST(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
req, err := http.NewRequest(
"POST",
@@ -233,6 +237,7 @@ func TestServer_JsonPayload_PUT(t *testing.T) {
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
+ time.Sleep(time.Millisecond * 10)
req, err := http.NewRequest("PUT", "http://localhost"+hs.Addr, bytes.NewBufferString(`{"key":"value"}`))
assert.NoError(t, err)