fix #277
Showing
1 changed file
with
11 additions
and
11 deletions
| ... | @@ -8,38 +8,38 @@ import ( | ... | @@ -8,38 +8,38 @@ import ( |
| 8 | var port = "" | 8 | var port = "" |
| 9 | var baseUrl = "http://localhost:" | 9 | var baseUrl = "http://localhost:" |
| 10 | 10 | ||
| 11 | type TestHttpRequest struct{ | 11 | type TestHttpRequest struct { |
| 12 | httplib.BeegoHttpRequest | 12 | httplib.BeegoHttpRequest |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | func getPort() string{ | 15 | func getPort() string { |
| 16 | if port==""{ | 16 | if port == "" { |
| 17 | config,err:= beego.LoadConfig("../conf/app.conf") | 17 | config, err := beego.ParseConfig("../conf/app.conf") |
| 18 | if err!=nil{ | 18 | if err != nil { |
| 19 | return "8080" | 19 | return "8080" |
| 20 | } | 20 | } |
| 21 | port=config.String("httpport") | 21 | port = config.String("httpport") |
| 22 | return port | 22 | return port |
| 23 | } | 23 | } |
| 24 | return port | 24 | return port |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | func Get(path string) *TestHttpRequest { | 27 | func Get(path string) *TestHttpRequest { |
| 28 | return &TestHttpRequest{*httplib.Get(baseUrl+getPort()+path)} | 28 | return &TestHttpRequest{*httplib.Get(baseUrl + getPort() + path)} |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | func Post(path string) *TestHttpRequest { | 31 | func Post(path string) *TestHttpRequest { |
| 32 | return &TestHttpRequest{*httplib.Post(baseUrl+getPort()+path)} | 32 | return &TestHttpRequest{*httplib.Post(baseUrl + getPort() + path)} |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | func Put(path string) *TestHttpRequest { | 35 | func Put(path string) *TestHttpRequest { |
| 36 | return &TestHttpRequest{*httplib.Put(baseUrl+getPort()+path)} | 36 | return &TestHttpRequest{*httplib.Put(baseUrl + getPort() + path)} |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | func Delete(path string) *TestHttpRequest { | 39 | func Delete(path string) *TestHttpRequest { |
| 40 | return &TestHttpRequest{*httplib.Delete(baseUrl+getPort()+path)} | 40 | return &TestHttpRequest{*httplib.Delete(baseUrl + getPort() + path)} |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | func Head(path string) *TestHttpRequest { | 43 | func Head(path string) *TestHttpRequest { |
| 44 | return &TestHttpRequest{*httplib.Head(baseUrl+getPort()+path)} | 44 | return &TestHttpRequest{*httplib.Head(baseUrl + getPort() + path)} |
| 45 | } | 45 | } | ... | ... |
-
Please register or sign in to post a comment