func request(_sling *sling.Sling, acceptHeader string, authInfo ...usrInfo) (int, []byte, error) { _sling = _sling.Set("Accept", acceptHeader) req, err := _sling.Request() if err != nil { return 400, nil, err } if len(authInfo) > 0 { req.SetBasicAuth(authInfo[0].Name, authInfo[0].Passwd) } w := httptest.NewRecorder() beego.BeeApp.Handlers.ServeHTTP(w, req) body, err := ioutil.ReadAll(w.Body) return w.Code, body, err }
// newStreamService returns a new StreamService. func newStreamService(client *http.Client, sling *sling.Sling) *StreamService { sling.Set("User-Agent", userAgent) return &StreamService{ client: client, public: sling.New().Base(publicStream).Path("statuses/"), user: sling.New().Base(userStream), site: sling.New().Base(siteStream), } }