From 77294a588138247d38ffaad8cc72677c925a8614 Mon Sep 17 00:00:00 2001 From: astaxie Date: Fri, 22 Aug 2014 16:50:07 +0800 Subject: [PATCH 1/2] utils: fix the SliceIntersect --- utils/slice.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/slice.go b/utils/slice.go index 729f6594..25032b7f 100644 --- a/utils/slice.go +++ b/utils/slice.go @@ -106,10 +106,10 @@ func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{}) { return } -// SliceIntersect returns diff slice of slice1 - slice2. +// SliceIntersect returns slice that are present in all the slice1 and slice2. func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{}) { for _, v := range slice1 { - if !InSliceIface(v, slice2) { + if InSliceIface(v, slice2) { diffslice = append(diffslice, v) } } From 35b4022ee0ae67741d29d1f638921c879d9bc757 Mon Sep 17 00:00:00 2001 From: astaxie Date: Fri, 22 Aug 2014 17:03:56 +0800 Subject: [PATCH 2/2] httplib: set the default proto --- httplib/httplib.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/httplib/httplib.go b/httplib/httplib.go index bb5fb9ea..101ee30b 100644 --- a/httplib/httplib.go +++ b/httplib/httplib.go @@ -79,6 +79,9 @@ func Get(url string) *BeegoHttpRequest { var resp http.Response req.Method = "GET" req.Header = http.Header{} + req.Proto = "HTTP/1.1" + req.ProtoMajor = 1 + req.ProtoMinor = 1 return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil} } @@ -88,6 +91,9 @@ func Post(url string) *BeegoHttpRequest { var resp http.Response req.Method = "POST" req.Header = http.Header{} + req.Proto = "HTTP/1.1" + req.ProtoMajor = 1 + req.ProtoMinor = 1 return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil} } @@ -97,6 +103,9 @@ func Put(url string) *BeegoHttpRequest { var resp http.Response req.Method = "PUT" req.Header = http.Header{} + req.Proto = "HTTP/1.1" + req.ProtoMajor = 1 + req.ProtoMinor = 1 return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil} } @@ -106,6 +115,9 @@ func Delete(url string) *BeegoHttpRequest { var resp http.Response req.Method = "DELETE" req.Header = http.Header{} + req.Proto = "HTTP/1.1" + req.ProtoMajor = 1 + req.ProtoMinor = 1 return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil} } @@ -115,6 +127,9 @@ func Head(url string) *BeegoHttpRequest { var resp http.Response req.Method = "HEAD" req.Header = http.Header{} + req.Proto = "HTTP/1.1" + req.ProtoMajor = 1 + req.ProtoMinor = 1 return &BeegoHttpRequest{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil} }