Cast is a http request library written in Golang.
This project is ready for production use and the master branch is always stable. But the API may be broken in the future release.
dep ensure -add github.com/xiaojiaoyu100/cast
c, err := cast.New(cast.WithBaseURL("https://status.github.com"))
request := c.NewRequest()
request := c.NewRequest().Get().WithPath("/api.json")
response, err := c.Do(request)
request := c.NewRequest().Get().WithPath("/api.json").WithFormURLEncodedBody(body)
resp, err := c.Do(request)
request := c.NewRequest().Post().WithPath("/api.json").WithJSONBody(body)
response, err := c.Do(request)
request := c.NewRequest().Post().WithPath("/api.json").WithXMLBody(body)
response, err := c.Do(request)
request := c.NewRequest().Post().WithPath("/api.json").WithMultipartFormDataBody(formData)
resp, err := c.Do(request)
c.NewRequest().WithTimeout(3 * time.Second)
cast.WithRetry(3)
cast.WithXXXBackoffStrategy()