Beispiel #1
0
func (s *clientSuite) TestGetNoBaseURL(c *gc.C) {
	srv := s.newServer()
	defer srv.Close()
	client := httprequest.Client{}
	var resp chM1Resp
	err := client.Get(srv.URL+"/m1/foo", &resp)
	c.Assert(err, gc.IsNil)
	c.Assert(resp, jc.DeepEquals, chM1Resp{"foo"})
}
Beispiel #2
0
func (s *clientSuite) TestCallURLNoRequestPath(c *gc.C) {
	srv := s.newServer()
	defer srv.Close()

	var client httprequest.Client
	req := struct {
		httprequest.Route `httprequest:"GET"`
		chM1Req
	}{
		chM1Req: chM1Req{
			P: "hello",
		},
	}
	var resp chM1Resp
	err := client.CallURL(srv.URL+"/m1/:P", &req, &resp)
	c.Assert(err, gc.IsNil)
	c.Assert(resp, jc.DeepEquals, chM1Resp{"hello"})
}