Пример #1
0
// Run makes GET requests to http://google.com
func (m *MyActor) Act() error {
	t := time.NewTicker(time.Second)

	req := goreq.Request{
		Uri: "http://google.com",
	}
	for {
		s, err := simulate.MakeRequest(req)
		if err != nil {
			return fmt.Errorf("got Error %+v ", err)
		}
		s.Response.Body.Close()
		<-t.C
	}
	return nil
}
Пример #2
0
// Post handles POST http requests
func (m *MyActor) Post() error {

	req := goreq.Request{
		Method: "POST",
		Uri:    "http://localhost:7676/jobs",
	}

	t := time.NewTicker(time.Second)
	for {
		s, err := simulate.MakeRequest(req)
		if err != nil {
			return err
		}
		defer s.Response.Body.Close()
		<-t.C
	}
	return nil
}