Most existing requests packages I've seen reimplement all features requests offers. This Request inherits all the behavior and functions of http.Requests package and adds others functions and behaviors.
- Retries
- Connection Timeouts
- byte and json streams
To install Requests, simply:
$ go get github.com/leonmaia/requests
package whatever
import (
"github.com/leonmaia/requests"
)
func GetExampleWithDefaultTimeoutAndRetries() error {
r, err := requests.NewRequest("GET", "http://google.com", nil)
if err != nil {
return err
}
response, err := r.Do()
if err != nil {
return err
}
// Do whatever you want with the response
return nil
}
I strongly encourage everyone whom creates a usefull custom assertion function to contribute them and help make this package even better.
Make sure all the tests are passing, and that you have covered all the changes you made.