summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-14 22:56:19 +0300
committerWolfy-J <[email protected]>2018-06-14 22:56:19 +0300
commit082c329d9dc84453a02693119d954f60a4792b11 (patch)
treea2e2279576c84a157c278869ee84d9f8f42b7c20 /service/http
parent5fef5b06e6261bc7c133380ef8b5bc8e63ac9fbe (diff)
fmt
Diffstat (limited to 'service/http')
-rw-r--r--service/http/config.go2
-rw-r--r--service/http/config_test.go6
-rw-r--r--service/http/handler.go4
-rw-r--r--service/http/handler_test.go24
-rw-r--r--service/http/request.go2
-rw-r--r--service/http/response.go2
-rw-r--r--service/http/response_test.go6
-rw-r--r--service/http/rpc_test.go10
-rw-r--r--service/http/service.go4
-rw-r--r--service/http/service_test.go16
-rw-r--r--service/http/uploads.go6
-rw-r--r--service/http/uploads_config.go4
-rw-r--r--service/http/uploads_config_test.go2
-rw-r--r--service/http/uploads_test.go30
14 files changed, 58 insertions, 60 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 2bc5f845..de791f45 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -1,8 +1,8 @@
package http
import (
- "github.com/spiral/roadrunner"
"errors"
+ "github.com/spiral/roadrunner"
"strings"
)
diff --git a/service/http/config_test.go b/service/http/config_test.go
index b806b79b..44c58f35 100644
--- a/service/http/config_test.go
+++ b/service/http/config_test.go
@@ -1,10 +1,10 @@
package http
import (
- "testing"
- "os"
- "github.com/stretchr/testify/assert"
"github.com/spiral/roadrunner"
+ "github.com/stretchr/testify/assert"
+ "os"
+ "testing"
"time"
)
diff --git a/service/http/handler.go b/service/http/handler.go
index a4cb6406..2c7c1fad 100644
--- a/service/http/handler.go
+++ b/service/http/handler.go
@@ -1,10 +1,10 @@
package http
import (
+ "github.com/pkg/errors"
+ "github.com/spiral/roadrunner"
"net/http"
"strconv"
- "github.com/spiral/roadrunner"
- "github.com/pkg/errors"
"sync"
)
diff --git a/service/http/handler_test.go b/service/http/handler_test.go
index d599b1d8..4a11c562 100644
--- a/service/http/handler_test.go
+++ b/service/http/handler_test.go
@@ -1,19 +1,19 @@
package http
import (
- "net/http"
- "io/ioutil"
+ "bytes"
+ "context"
"github.com/spiral/roadrunner"
- "testing"
- "os"
"github.com/stretchr/testify/assert"
+ "io/ioutil"
+ "mime/multipart"
+ "net/http"
"net/url"
+ "os"
+ "runtime"
"strings"
- "context"
- "bytes"
- "mime/multipart"
+ "testing"
"time"
- "runtime"
)
// get request and return body
@@ -86,7 +86,7 @@ func TestServer_Headers(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8078", Handler: st,}
+ hs := &http.Server{Addr: ":8078", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -133,7 +133,7 @@ func TestServer_Cookies(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8079", Handler: st,}
+ hs := &http.Server{Addr: ":8079", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -184,7 +184,7 @@ func TestServer_JsonPayload_POST(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8090", Handler: st,}
+ hs := &http.Server{Addr: ":8090", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -326,7 +326,7 @@ func TestServer_FormData_POST(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8083", Handler: st,}
+ hs := &http.Server{Addr: ":8083", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
diff --git a/service/http/request.go b/service/http/request.go
index d88c260e..2e8ae090 100644
--- a/service/http/request.go
+++ b/service/http/request.go
@@ -6,8 +6,8 @@ import (
"github.com/spiral/roadrunner"
"io/ioutil"
"net/http"
- "strings"
"net/url"
+ "strings"
)
const (
diff --git a/service/http/response.go b/service/http/response.go
index 69bcf3e1..d43f514d 100644
--- a/service/http/response.go
+++ b/service/http/response.go
@@ -3,8 +3,8 @@ package http
import (
"encoding/json"
"github.com/spiral/roadrunner"
- "net/http"
"io"
+ "net/http"
)
// Response handles PSR7 response logic.
diff --git a/service/http/response_test.go b/service/http/response_test.go
index e45f5349..f885be7f 100644
--- a/service/http/response_test.go
+++ b/service/http/response_test.go
@@ -1,12 +1,12 @@
package http
import (
- "net/http"
"bytes"
- "testing"
+ "errors"
"github.com/spiral/roadrunner"
"github.com/stretchr/testify/assert"
- "errors"
+ "net/http"
+ "testing"
)
type testWriter struct {
diff --git a/service/http/rpc_test.go b/service/http/rpc_test.go
index f1c5786c..fc47a70f 100644
--- a/service/http/rpc_test.go
+++ b/service/http/rpc_test.go
@@ -1,14 +1,14 @@
package http
import (
- "testing"
- "github.com/sirupsen/logrus/hooks/test"
"github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus/hooks/test"
"github.com/spiral/roadrunner/service"
- "github.com/stretchr/testify/assert"
- "time"
"github.com/spiral/roadrunner/service/rpc"
+ "github.com/stretchr/testify/assert"
"strconv"
+ "testing"
+ "time"
)
func Test_RPC(t *testing.T) {
@@ -112,4 +112,4 @@ func Test_Workers(t *testing.T) {
assert.Len(t, r.Workers, 1)
assert.Equal(t, *ss.rr.Workers()[0].Pid, r.Workers[0].Pid)
-} \ No newline at end of file
+}
diff --git a/service/http/service.go b/service/http/service.go
index 8485cba6..70980859 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -1,11 +1,11 @@
package http
import (
- "net/http"
- "github.com/spiral/roadrunner/service"
"context"
"github.com/spiral/roadrunner"
+ "github.com/spiral/roadrunner/service"
"github.com/spiral/roadrunner/service/rpc"
+ "net/http"
"sync"
)
diff --git a/service/http/service_test.go b/service/http/service_test.go
index ebcd0f5a..55fa660b 100644
--- a/service/http/service_test.go
+++ b/service/http/service_test.go
@@ -1,18 +1,18 @@
package http
import (
- "testing"
- "github.com/spiral/roadrunner/service"
- "github.com/sirupsen/logrus/hooks/test"
- "github.com/sirupsen/logrus"
"encoding/json"
+ "github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus/hooks/test"
+ "github.com/spiral/roadrunner"
+ "github.com/spiral/roadrunner/service"
+ "github.com/spiral/roadrunner/service/rpc"
"github.com/stretchr/testify/assert"
+ "io/ioutil"
+ "net/http"
"os"
+ "testing"
"time"
- "net/http"
- "io/ioutil"
- "github.com/spiral/roadrunner"
- "github.com/spiral/roadrunner/service/rpc"
)
type testCfg struct {
diff --git a/service/http/uploads.go b/service/http/uploads.go
index f8334c30..4607dea4 100644
--- a/service/http/uploads.go
+++ b/service/http/uploads.go
@@ -2,11 +2,11 @@ package http
import (
"encoding/json"
+ "io"
+ "io/ioutil"
+ "mime/multipart"
"os"
"sync"
- "mime/multipart"
- "io/ioutil"
- "io"
)
const (
diff --git a/service/http/uploads_config.go b/service/http/uploads_config.go
index 715de69a..148ebba3 100644
--- a/service/http/uploads_config.go
+++ b/service/http/uploads_config.go
@@ -1,9 +1,9 @@
package http
import (
- "strings"
- "path"
"os"
+ "path"
+ "strings"
)
// UploadsConfig describes file location and controls access to them.
diff --git a/service/http/uploads_config_test.go b/service/http/uploads_config_test.go
index 7704a486..2b6ceebc 100644
--- a/service/http/uploads_config_test.go
+++ b/service/http/uploads_config_test.go
@@ -1,9 +1,9 @@
package http
import (
- "testing"
"github.com/stretchr/testify/assert"
"os"
+ "testing"
)
func TestFsConfig_Forbids(t *testing.T) {
diff --git a/service/http/uploads_test.go b/service/http/uploads_test.go
index af351067..b2662bf7 100644
--- a/service/http/uploads_test.go
+++ b/service/http/uploads_test.go
@@ -1,20 +1,20 @@
package http
import (
- "github.com/spiral/roadrunner"
- "github.com/stretchr/testify/assert"
- "net/http"
- "time"
"bytes"
- "mime/multipart"
- "io/ioutil"
- "testing"
- "os"
"context"
- "io"
- "encoding/json"
"crypto/md5"
"encoding/hex"
+ "encoding/json"
+ "github.com/spiral/roadrunner"
+ "github.com/stretchr/testify/assert"
+ "io"
+ "io/ioutil"
+ "mime/multipart"
+ "net/http"
+ "os"
+ "testing"
+ "time"
)
func TestServer_Upload_File(t *testing.T) {
@@ -40,7 +40,7 @@ func TestServer_Upload_File(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8021", Handler: st,}
+ hs := &http.Server{Addr: ":8021", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -101,7 +101,7 @@ func TestServer_Upload_NestedFile(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8021", Handler: st,}
+ hs := &http.Server{Addr: ":8021", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -139,7 +139,6 @@ func TestServer_Upload_NestedFile(t *testing.T) {
assert.Equal(t, `{"upload":{"x":{"y":{"z":[`+fs+`]}}}}`, string(b))
}
-
func TestServer_Upload_File_NoTmpDir(t *testing.T) {
st := &Handler{
cfg: &Config{
@@ -163,7 +162,7 @@ func TestServer_Upload_File_NoTmpDir(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8021", Handler: st,}
+ hs := &http.Server{Addr: ":8021", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()
@@ -201,7 +200,6 @@ func TestServer_Upload_File_NoTmpDir(t *testing.T) {
assert.Equal(t, `{"upload":`+fs+`}`, string(b))
}
-
func TestServer_Upload_File_Forbids(t *testing.T) {
st := &Handler{
cfg: &Config{
@@ -225,7 +223,7 @@ func TestServer_Upload_File_Forbids(t *testing.T) {
assert.NoError(t, st.rr.Start())
defer st.rr.Stop()
- hs := &http.Server{Addr: ":8021", Handler: st,}
+ hs := &http.Server{Addr: ":8021", Handler: st}
defer hs.Shutdown(context.Background())
go func() { hs.ListenAndServe() }()