From de1833c230c0f1b2844913bbb79d779195abf667 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 8 Jan 2020 00:24:32 +0800 Subject: [PATCH] chore: ignore unnecessary package. --- Makefile | 6 +- README.md | 18 +-- {example => _example}/basic.go | 0 {example => _example}/basic_test.go | 0 {example => _example}/beego.go | 0 {example => _example}/beego_test.go | 0 {example => _example}/echo.go | 2 +- {example => _example}/echo_test.go | 0 {example => _example}/gin.go | 0 {example => _example}/gin_test.go | 0 {example => _example}/httprouter.go | 0 {example => _example}/httprouter_test.go | 0 {example => _example}/mux.go | 0 {example => _example}/mux_test.go | 0 {example => _example}/pat.go | 0 {example => _example}/pat_test.go | 0 {example => _example}/tango.go | 0 {example => _example}/tango_test.go | 0 {framework => _framework}/echo.go | 2 +- {framework => _framework}/gin.go | 0 gofight_test.go => _framework/gofight_test.go | 25 +++++ go.mod | 20 +--- go.sum | 103 ------------------ gofight.go | 29 ----- 24 files changed, 37 insertions(+), 168 deletions(-) rename {example => _example}/basic.go (100%) rename {example => _example}/basic_test.go (100%) rename {example => _example}/beego.go (100%) rename {example => _example}/beego_test.go (100%) rename {example => _example}/echo.go (91%) rename {example => _example}/echo_test.go (100%) rename {example => _example}/gin.go (100%) rename {example => _example}/gin_test.go (100%) rename {example => _example}/httprouter.go (100%) rename {example => _example}/httprouter_test.go (100%) rename {example => _example}/mux.go (100%) rename {example => _example}/mux_test.go (100%) rename {example => _example}/pat.go (100%) rename {example => _example}/pat_test.go (100%) rename {example => _example}/tango.go (100%) rename {example => _example}/tango_test.go (100%) rename {framework => _framework}/echo.go (98%) rename {framework => _framework}/gin.go (100%) rename gofight_test.go => _framework/gofight_test.go (95%) diff --git a/Makefile b/Makefile index 0fd4bcd..daee4bf 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,10 @@ fmt-check: fi; test: fmt-check - @$(GO) test -v -cover -coverprofile coverage.txt $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 + @$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1 vet: - $(GO) vet $(PACKAGES) + $(GO) vet ./... lint: @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @@ -46,7 +46,7 @@ misspell-check: @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ $(GO) get -u github.com/client9/misspell/cmd/misspell; \ fi - misspell -error $(GOFILES) + misspell -error ./... .PHONY: misspell misspell: diff --git a/README.md b/README.md index d5d5ed8..c15ac52 100644 --- a/README.md +++ b/README.md @@ -422,18 +422,12 @@ func TestUploadFileByContent(t *testing.T) { ## Example -* Basic HTTP Router: [basic.go](example/basic.go), [basic_test.go](example/basic_test.go) -* Gin Framework: [gin.go](example/gin.go), [gin_test.go](example/gin_test.go) -* Echo Framework: [echo.go](example/echo.go), [echo_test.go](example/echo_test.go) -* Mux Framework: [mux.go](example/mux.go), [mux_test.go](example/mux_test.go) -* HttpRouter Framework: [httprouter.go](example/httprouter.go), [httprouter_test.go](example/httprouter_test.go) -* Beego Framework: [beego.go](example/beego.go), [beego_test.go](example/beego_test.go) - -## Testing - -``` -$ make -``` +* Basic HTTP Router: [basic.go](_example/basic.go), [basic_test.go](_example/basic_test.go) +* Gin Framework: [gin.go](_example/gin.go), [gin_test.go](_example/gin_test.go) +* Echo Framework: [echo.go](_example/echo.go), [echo_test.go](_example/echo_test.go) +* Mux Framework: [mux.go](_example/mux.go), [mux_test.go](_example/mux_test.go) +* HttpRouter Framework: [httprouter.go](_example/httprouter.go), [httprouter_test.go](_example/httprouter_test.go) +* Beego Framework: [beego.go](_example/beego.go), [beego_test.go](_example/beego_test.go) ## License diff --git a/example/basic.go b/_example/basic.go similarity index 100% rename from example/basic.go rename to _example/basic.go diff --git a/example/basic_test.go b/_example/basic_test.go similarity index 100% rename from example/basic_test.go rename to _example/basic_test.go diff --git a/example/beego.go b/_example/beego.go similarity index 100% rename from example/beego.go rename to _example/beego.go diff --git a/example/beego_test.go b/_example/beego_test.go similarity index 100% rename from example/beego_test.go rename to _example/beego_test.go diff --git a/example/echo.go b/_example/echo.go similarity index 91% rename from example/echo.go rename to _example/echo.go index 75cd833..51ca677 100644 --- a/example/echo.go +++ b/_example/echo.go @@ -3,7 +3,7 @@ package example import ( "net/http" - "github.com/labstack/echo" + "github.com/labstack/echo/v4" ) func echoHelloHandler() echo.HandlerFunc { diff --git a/example/echo_test.go b/_example/echo_test.go similarity index 100% rename from example/echo_test.go rename to _example/echo_test.go diff --git a/example/gin.go b/_example/gin.go similarity index 100% rename from example/gin.go rename to _example/gin.go diff --git a/example/gin_test.go b/_example/gin_test.go similarity index 100% rename from example/gin_test.go rename to _example/gin_test.go diff --git a/example/httprouter.go b/_example/httprouter.go similarity index 100% rename from example/httprouter.go rename to _example/httprouter.go diff --git a/example/httprouter_test.go b/_example/httprouter_test.go similarity index 100% rename from example/httprouter_test.go rename to _example/httprouter_test.go diff --git a/example/mux.go b/_example/mux.go similarity index 100% rename from example/mux.go rename to _example/mux.go diff --git a/example/mux_test.go b/_example/mux_test.go similarity index 100% rename from example/mux_test.go rename to _example/mux_test.go diff --git a/example/pat.go b/_example/pat.go similarity index 100% rename from example/pat.go rename to _example/pat.go diff --git a/example/pat_test.go b/_example/pat_test.go similarity index 100% rename from example/pat_test.go rename to _example/pat_test.go diff --git a/example/tango.go b/_example/tango.go similarity index 100% rename from example/tango.go rename to _example/tango.go diff --git a/example/tango_test.go b/_example/tango_test.go similarity index 100% rename from example/tango_test.go rename to _example/tango_test.go diff --git a/framework/echo.go b/_framework/echo.go similarity index 98% rename from framework/echo.go rename to _framework/echo.go index 4e49c5c..04285a0 100644 --- a/framework/echo.go +++ b/_framework/echo.go @@ -4,7 +4,7 @@ import ( "log" "net/http" - "github.com/labstack/echo" + "github.com/labstack/echo/v4" ) type echoContent struct { diff --git a/framework/gin.go b/_framework/gin.go similarity index 100% rename from framework/gin.go rename to _framework/gin.go diff --git a/gofight_test.go b/_framework/gofight_test.go similarity index 95% rename from gofight_test.go rename to _framework/gofight_test.go index d03d6e7..36e8093 100644 --- a/gofight_test.go +++ b/_framework/gofight_test.go @@ -1,6 +1,7 @@ package gofight import ( + "crypto/tls" "io/ioutil" "log" "net/http" @@ -16,6 +17,30 @@ import ( var goVersion = runtime.Version() +// TestRequest is testing url string if server is running +func TestRequest(t *testing.T, url string) { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client := &http.Client{ + Timeout: Timeout, + Transport: tr, + } + + resp, err := client.Get(url) + defer func() { + if err := resp.Body.Close(); err != nil { + log.Println("close body err:", err) + } + }() + + assert.NoError(t, err) + + _, ioerr := ioutil.ReadAll(resp.Body) + assert.NoError(t, ioerr) + assert.Equal(t, "200 OK", resp.Status, "should get a 200") +} + func TestHttpURL(t *testing.T) { gin.SetMode(gin.TestMode) router := gin.New() diff --git a/go.mod b/go.mod index c8f2ca0..cb7709a 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,3 @@ module github.com/appleboy/gofight/v2 -go 1.12 - -require ( - gitea.com/lunny/tango v0.6.1 - github.com/astaxie/beego v1.11.1 - github.com/gin-gonic/gin v1.4.0 - github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/mux v1.7.2 - github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1 - github.com/julienschmidt/httprouter v1.2.0 - github.com/labstack/echo v3.3.10+incompatible - github.com/labstack/gommon v0.2.8 // indirect - github.com/mattn/go-colorable v0.1.2 // indirect - github.com/stretchr/testify v1.3.0 - github.com/tidwall/gjson v1.2.1 - github.com/tidwall/match v1.0.1 // indirect - github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 // indirect - github.com/valyala/fasttemplate v1.0.1 // indirect -) +go 1.13 diff --git a/go.sum b/go.sum index 25b34e5..e69de29 100644 --- a/go.sum +++ b/go.sum @@ -1,103 +0,0 @@ -gitea.com/lunny/log v0.0.0-20190322053110-01b5df579c4e h1:r1en/D7xJmcY24VkHkjkcJFa+7ZWubVWPBrvsHkmHxk= -gitea.com/lunny/log v0.0.0-20190322053110-01b5df579c4e/go.mod h1:uJEsN4LQpeGYRCjuPXPZBClU7N5pWzGuyF4uqLpE/e0= -gitea.com/lunny/tango v0.6.1 h1:/Fa0TZ5BY6gjWAgo0LzA0tdY8Az/fG6/oTTbFkpmxt0= -gitea.com/lunny/tango v0.6.1/go.mod h1:ebPnYxaYz9qzByTh3A7604q3tcj0QtATtdwvsAafswU= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/astaxie/beego v1.11.1 h1:6DESefxW5oMcRLFRKi53/6exzup/IR6N4EzzS1n6CnQ= -github.com/astaxie/beego v1.11.1/go.mod h1:i69hVzgauOPSw5qeyF4GVZhn7Od0yG5bbCGzmhbWxgQ= -github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= -github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= -github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff/go.mod h1:PhH1ZhyCzHKt4uAasyx+ljRCgoezetRNf59CUtwUkqY= -github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= -github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= -github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= -github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= -github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= -github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ= -github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1 h1:LqbZZ9sNMWVjeXS4NN5oVvhMjDyLhmA1LG86oSo+IqY= -github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= -github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= -github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= -github.com/labstack/gommon v0.2.8 h1:JvRqmeZcfrHC5u6uVleB4NxxNbzx6gpbJiQknDbKQu0= -github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg= -github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= -github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/tidwall/gjson v1.2.1 h1:j0efZLrZUvNerEf6xqoi0NjWMK5YlLrR7Guo/dxY174= -github.com/tidwall/gjson v1.2.1/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA= -github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= -github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 h1:rQ229MBgvW68s1/g6f1/63TgYwYxfF4E+bi/KC19P8g= -github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= -golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/gofight.go b/gofight.go index 28d7a5f..a55e386 100644 --- a/gofight.go +++ b/gofight.go @@ -51,10 +51,8 @@ package gofight import ( "bytes" - "crypto/tls" "encoding/json" "io" - "io/ioutil" "log" "mime/multipart" "net/http" @@ -63,10 +61,7 @@ import ( "os" "path/filepath" "strings" - "testing" "time" - - "github.com/stretchr/testify/assert" ) // Media types @@ -115,30 +110,6 @@ type UploadFile struct { Content []byte } -// TestRequest is testing url string if server is running -func TestRequest(t *testing.T, url string) { - tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - } - client := &http.Client{ - Timeout: Timeout, - Transport: tr, - } - - resp, err := client.Get(url) - defer func() { - if err := resp.Body.Close(); err != nil { - log.Println("close body err:", err) - } - }() - - assert.NoError(t, err) - - _, ioerr := ioutil.ReadAll(resp.Body) - assert.NoError(t, ioerr) - assert.Equal(t, "200 OK", resp.Status, "should get a 200") -} - // New supply initial structure func New() *RequestConfig {