Skip to content

Commit

Permalink
GH #374 review comments incorporated for readme and update retry valu…
Browse files Browse the repository at this point in the history
…e on attempt

Signed-off-by: Jeevanandam M <jeeva@myjeeva.com>
  • Loading branch information
jeevatkm committed Sep 11, 2020
1 parent 038920c commit 6f161d3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

* v2.3.0 [released](https://github.com/go-resty/resty/releases/tag/v2.3.0) and tagged on May 20, 2020.
* v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019.
* v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
* v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
* v1.0 released and tagged on Sep 25, 2017. - Resty's first version was released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years since first release. I'm very thankful to Resty users and its [contributors](https://github.com/go-resty/resty/graphs/contributors).

## Features
Expand Down Expand Up @@ -83,7 +83,7 @@

#### Supported Go Versions

Initially Resty started supporting `go modules` since `v1.10.0` release.
Initially Resty started supporting `go modules` since `v1.10.0` release.

Starting Resty v2 and higher versions, it fully embraces [go modules](https://github.com/golang/go/wiki/Modules) package release. It requires a Go version capable of understanding `/vN` suffixed imports:

Expand Down Expand Up @@ -151,38 +151,41 @@ fmt.Println("TotalTime :", ti.TotalTime)
fmt.Println("IsConnReused :", ti.IsConnReused)
fmt.Println("IsConnWasIdle:", ti.IsConnWasIdle)
fmt.Println("ConnIdleTime :", ti.ConnIdleTime)
fmt.Println("RemoteAddr :", ti.RemoteAddr.String())

/* Output
Response Info:
Error : <nil>
Status Code: 200
Status : 200 OK
Proto : HTTP/2.0
Time : 475.611189ms
Received At: 2020-05-19 00:11:06.828188 -0700 PDT m=+0.476510773
Time : 501.370287ms
Received At: 2020-09-09 20:42:49.796051 -0700 PDT m=+0.502492236
Body :
{
"args": {},
"headers": {
"Accept-Encoding": "gzip",
"Host": "httpbin.org",
"User-Agent": "go-resty/2.3.0 (https://github.com/go-resty/resty)"
"User-Agent": "go-resty/2.3.0-dev (https://github.com/go-resty/resty)",
"X-Amzn-Trace-Id": "Root=1-5f59a0b9-793df69cb040d1aa15dbb35e"
},
"origin": "0.0.0.0",
"url": "https://httpbin.org/get"
}
Request Trace Info:
DNSLookup : 4.870246ms
ConnTime : 393.95373ms
TCPConnTime : 78.360432ms
TLSHandshake : 310.032859ms
ServerTime : 81.648284ms
ResponseTime : 124.266µs
TotalTime : 475.611189ms
DNSLookup : 3.739403ms
ConnTime : 427.835202ms
TCPConnTime : 75.362334ms
TLSHandshake : 348.197338ms
ServerTime : 73.610477ms
ResponseTime : 74.23µs
TotalTime : 501.370287ms
IsConnReused : false
IsConnWasIdle: false
ConnIdleTime : 0s
RemoteAddr : 3.221.81.55:443
*/
```

Expand Down Expand Up @@ -831,7 +834,7 @@ More detailed example of mocking resty http requests using ginko could be found
Resty releases versions according to [Semantic Versioning](http://semver.org)

* Resty v2 does not use `gopkg.in` service for library versioning.
* Resty fully adapted to `go mod` capabilities since `v1.10.0` release.
* Resty fully adapted to `go mod` capabilities since `v1.10.0` release.
* Resty v1 series was using `gopkg.in` to provide versioning. `gopkg.in/resty.vX` points to appropriate tagged versions; `X` denotes version series number and it's a stable release for production use. For e.g. `gopkg.in/resty.v0`.
* Development takes place at the master branch. Although the code in master should always compile and test successfully, it might break API's. I aim to maintain backwards compatibility, but sometimes API's and behavior might be changed to fix a bug.

Expand Down
3 changes: 1 addition & 2 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ func (r *Request) Execute(method, url string) (*Response, error) {
err = Backoff(
func() (*Response, error) {
attempt++
r.RetryAttempt = attempt

r.URL = r.selectAddr(addrs, url, attempt)

Expand All @@ -713,8 +714,6 @@ func (r *Request) Execute(method, url string) (*Response, error) {
RetryConditions(r.client.RetryConditions),
)

r.RetryAttempt = attempt

return resp, unwrapNoRetryErr(err)
}

Expand Down
2 changes: 1 addition & 1 deletion resty.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// Version # of resty
const Version = "2.3.0"
const Version = "2.3.0-dev"

// New method creates a new Resty client.
func New() *Client {
Expand Down

0 comments on commit 6f161d3

Please sign in to comment.