grim/resticide
Clone
Summary
Browse
Changes
Graph
merging
develop
2015-11-09, Gary Kramlich
6bdbec3f6a40
Parents
6a0bbf2b1d04
265502e6688c
Children
74baea137254
merging
1 files changed, 16 insertions(+), 2 deletions(-)
+16
-2
test.go
--- a/test.go Mon Nov 09 19:26:35 2015 -0600
+++ b/test.go Mon Nov 09 19:26:50 2015 -0600
@@ -4,6 +4,7 @@
"bytes"
"io/ioutil"
"net/http"
+ "net/url"
"time"
"github.com/xeipuuv/gojsonschema"
@@ -42,10 +43,23 @@
}
func (req *TestRequest)buildRequest(host string) (*http.Request, error) {
- uri := host + req.Path
+ url, err := url.Parse(host)
+ if err != nil {
+ return nil, err
+ }
+
+ url.Path = req.Path
+
+ // build the query string
+ query := url.Query()
+ for qname, qvalue := range req.Query {
+ query.Set(qname, qvalue)
+ }
+ url.RawQuery = query.Encode()
+
body := bytes.NewBufferString(req.Body)
- hreq, err := http.NewRequest(req.Method, uri, body)
+ hreq, err := http.NewRequest(req.Method, url.String(), body)
if err != nil {
return nil, err
}