streams.go
changeset 120 579912e9d0ef
parent 117 7f8ac782cf5d
child 122 50c7733ee886
--- a/streams.go	Sat Apr 15 00:39:43 2017 +0200
+++ b/streams.go	Sat Apr 15 10:26:36 2017 +0200
@@ -28,7 +28,7 @@
 // The stream name can be "user", "public" or "hashtag".
 // For "hashtag", the hashTag argument cannot be empty.
 func (g *Client) openStream(streamName, hashTag string) (*http.Response, error) {
-	req := g.prepareRequest("streaming/" + streamName)
+	params := make(apiCallParams)
 
 	switch streamName {
 	case "user", "public":
@@ -36,15 +36,17 @@
 		if hashTag == "" {
 			return nil, ErrInvalidParameter
 		}
-		req.QueryParams["tag"] = hashTag
+		params["tag"] = hashTag
 	default:
 		return nil, ErrInvalidParameter
 	}
 
+	req := g.prepareRequest("streaming/"+streamName, rest.Get, params)
 	reqObj, err := rest.BuildRequestObject(req)
 	if err != nil {
 		return nil, fmt.Errorf("cannot build stream request: %s", err.Error())
 	}
+
 	resp, err := rest.MakeRequest(reqObj)
 	if err != nil {
 		return nil, fmt.Errorf("cannot open stream: %s", err.Error())