GoRequest -- Simplified HTTP client ( inspired by famous SuperAgent lib in Node.js )
Sending request would never been fun and easier than this. It comes with lots of feature:
- Get/Post/Put/Head/Delete/Patch/Options
- Set - simple header setting
- JSON - made it simple with JSON string as a parameter
- Multipart-Support - send data and files as multipart request
- Proxy - sending request via proxy
- Timeout - setting timeout for a request
- TLSClientConfig - taking control over tls where at least you can disable security check for https
- RedirectPolicy
- Cookie - setting cookies for your request
- CookieJar - automatic in-memory cookiejar
- BasicAuth - setting basic authentication header
- more to come..
$ go get github.com/parnurzeal/gorequest
See Go Doc or Go Walker for usage and details.
GoRequest makes thing much more simple for you, making http client more awesome and fun like SuperAgent + golang style usage.
This is what you normally do for a simple GET without GoRequest:
resp, err := http.Get("https://example.com/")
With GoRequest:
request := gorequest.New()
resp, body, errs := request.Get("https://example.com/").End()
Or below if you don't want to reuse it for other requests.
resp, body, errs := gorequest.New().Get("https://example.com/").End()
How about getting control over HTTP client headers, redirect policy, and etc. Things is getting more complicated in golang. You need to create a Client, setting header in different command, ... to do just only one GET