From d8f2b05e0861cf99ff24623268758c18cd40d885 Mon Sep 17 00:00:00 2001 From: JessonChan Date: Sat, 23 Aug 2014 07:02:47 +0800 Subject: [PATCH] improve the code and delete NO NEED URL CHECK --- httplib/httplib.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/httplib/httplib.go b/httplib/httplib.go index a1396e87..b7220a60 100644 --- a/httplib/httplib.go +++ b/httplib/httplib.go @@ -75,14 +75,14 @@ func SetDefaultSetting(setting BeegoHttpSettings) { // return *BeegoHttpRequest with specific method func newBeegoRequest(url, method string) *BeegoHttpRequest { + var resp http.Response req := http.Request{ + Method: method, + Header: make(http.Header), Proto: "HTTP/1.1", ProtoMajor: 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} } @@ -310,10 +310,6 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) { } url, err := url.Parse(b.url) - if url.Scheme == "" { - b.url = "http://" + b.url - url, err = url.Parse(b.url) - } if err != nil { return nil, err }