mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 23:30:54 +00:00
improve the code and delete NO NEED URL CHECK
This commit is contained in:
parent
7b2fe824d5
commit
d8f2b05e08
@ -75,14 +75,14 @@ func SetDefaultSetting(setting BeegoHttpSettings) {
|
|||||||
|
|
||||||
// return *BeegoHttpRequest with specific method
|
// return *BeegoHttpRequest with specific method
|
||||||
func newBeegoRequest(url, method string) *BeegoHttpRequest {
|
func newBeegoRequest(url, method string) *BeegoHttpRequest {
|
||||||
|
var resp http.Response
|
||||||
req := http.Request{
|
req := http.Request{
|
||||||
|
Method: method,
|
||||||
|
Header: make(http.Header),
|
||||||
Proto: "HTTP/1.1",
|
Proto: "HTTP/1.1",
|
||||||
ProtoMajor: 1,
|
ProtoMajor: 1,
|
||||||
ProtoMinor: 1,
|
ProtoMinor: 1,
|
||||||
}
|
}
|
||||||
var resp http.Response
|
|
||||||
req.Method = method
|
|
||||||
req.Header = http.Header{}
|
|
||||||
return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil}
|
return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,10 +310,6 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
url, err := url.Parse(b.url)
|
url, err := url.Parse(b.url)
|
||||||
if url.Scheme == "" {
|
|
||||||
b.url = "http://" + b.url
|
|
||||||
url, err = url.Parse(b.url)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user