Skip to content

Commit 321cab9

Browse files
authored
release: version bump and readme update for v2.15.0 (#852)
1 parent 8e6cfc2 commit 321cab9

File tree

2 files changed

+46
-41
lines changed

2 files changed

+46
-41
lines changed

README.md

+45-40
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p align="center"><a href="#features">Features</a> section describes in detail about Resty capabilities</p>
55
</p>
66
<p align="center">
7-
<p align="center"><a href="https://github.com/go-resty/resty/actions/workflows/ci.yml?query=branch%3Amaster"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a> <a href="https://codecov.io/gh/go-resty/resty/branch/master"><img src="https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.14.0-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
7+
<p align="center"><a href="https://github.com/go-resty/resty/actions/workflows/ci.yml?query=branch%3Amaster"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a> <a href="https://codecov.io/gh/go-resty/resty/branch/master"><img src="https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.15.0-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
88
</p>
99
<p align="center">
1010
<h4 align="center">Resty Communication Channels</h4>
@@ -13,7 +13,7 @@
1313

1414
## News
1515

16-
* v2.14.0 [released](https://github.com/go-resty/resty/releases/tag/v2.14.0) and tagged on Aug 04, 2024.
16+
* v2.15.0 [released](https://github.com/go-resty/resty/releases/tag/v2.15.0) and tagged on Sep 14, 2024.
1717
* v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019.
1818
* v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
1919
* 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).
@@ -62,10 +62,10 @@
6262
* goroutine concurrent safe
6363
* Resty Client trace, see [Client.EnableTrace](https://pkg.go.dev/github.com/go-resty/resty/v2#Client.EnableTrace) and [Request.EnableTrace](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.EnableTrace)
6464
* Since v2.4.0, trace info contains a `RequestAttempt` value, and the `Request` object contains an `Attempt` attribute
65-
* Supports `GenerateCurlCommand`(**You should turn on `EnableTrace`**, otherwise the curl command will not contain the body)
65+
* Supports on-demand CURL command generation, see [Client.EnableGenerateCurlOnDebug](https://pkg.go.dev/github.com/go-resty/resty/v2#Client.EnableGenerateCurlOnDebug), [Request.EnableGenerateCurlOnDebug](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.EnableGenerateCurlOnDebug). It requires debug mode to be enabled.
6666
* Debug mode - clean and informative logging presentation
6767
* Gzip - Go does it automatically also resty has fallback handling too
68-
* Works fine with `HTTP/2` and `HTTP/1.1`
68+
* Works fine with `HTTP/2` and `HTTP/1.1`, also `HTTP/3` can be used with Resty, see this [comment](https://github.com/go-resty/resty/issues/846#issuecomment-2329696110)
6969
* [Bazel support](#bazel-support)
7070
* Easily mock Resty for testing, [for e.g.](#mocking-http-requests-using-httpmock-library)
7171
* Well tested client library
@@ -87,7 +87,7 @@
8787

8888
#### Supported Go Versions
8989

90-
Recommended to use `go1.16` and above.
90+
Recommended to use `go1.20` and above.
9191

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

@@ -102,16 +102,14 @@ Starting Resty v2 and higher versions, it fully embraces [go modules](https://gi
102102

103103
Resty author also published following projects for Go Community.
104104

105-
* [aah framework](https://aahframework.org) - A secure, flexible, rapid Go web framework.
106-
* [THUMBAI](https://thumbai.app) - Go Mod Repository, Go Vanity Service and Simple Proxy Server.
107105
* [go-model](https://github.com/jeevatkm/go-model) - Robust & Easy to use model mapper and utility methods for Go `struct`.
108106

109107

110108
## Installation
111109

112110
```bash
113111
# Go Modules
114-
require github.com/go-resty/resty/v2 v2.11.0
112+
require github.com/go-resty/resty/v2 v2.15.0
115113
```
116114

117115
## Usage
@@ -123,21 +121,15 @@ The following samples will assist you to become as comfortable as possible with
123121
import "github.com/go-resty/resty/v2"
124122
```
125123

126-
#### Simple POST
127-
>Refer: [debug_curl_test.go](https://github.com/go-resty/resty/blob/v2/examples/debug_curl_test.go)
124+
#### Simple GET
128125

129126
```go
130127
// Create a Resty Client
131128
client := resty.New()
132129

133130
resp, err := client.R().
134-
EnableTrace(). // You should turn on `EnableTrace`, otherwise the curl command will not contain the body
135-
SetBody(map[string]string{"name": "Alex"}).
136-
Post("https://httpbin.org/post")
137-
curlCmdExecuted := resp.Request.GenerateCurlCommand()
138-
139-
// Explore curl command
140-
fmt.Println("Curl Command:\n ", curlCmdExecuted+"\n")
131+
EnableTrace().
132+
Get("https://httpbin.org/get")
141133

142134
// Explore response object
143135
fmt.Println("Response Info:")
@@ -167,36 +159,25 @@ fmt.Println(" RequestAttempt:", ti.RequestAttempt)
167159
fmt.Println(" RemoteAddr :", ti.RemoteAddr.String())
168160

169161
/* Output
170-
Curl Command:
171-
curl -X POST -H 'Content-Type: application/json' -H 'User-Agent: go-resty/2.14.0 (https://github.com/go-resty/resty)' -d '{"name":"Alex"}' https://httpbin.org/post
172-
173162
Response Info:
174163
Error : <nil>
175164
Status Code: 200
176165
Status : 200 OK
177166
Proto : HTTP/2.0
178167
Time : 457.034718ms
179-
Received At: 2024-08-09 13:02:57.187544 +0800 CST m=+1.304888501
168+
Received At: 2020-09-14 15:35:29.784681 -0700 PDT m=+0.458137045
180169
Body :
181-
{
182-
"args": {},
183-
"data": "{\"name\":\"Alex\"}",
184-
"files": {},
185-
"form": {},
186-
"headers": {
187-
"Accept-Encoding": "gzip",
188-
"Content-Length": "15",
189-
"Content-Type": "application/json",
190-
"Host": "httpbin.org",
191-
"User-Agent": "go-resty/2.14.0 (https://github.com/go-resty/resty)",
192-
"X-Amzn-Trace-Id": "Root=1-66b5a301-567c83c86562abd3092f5e19"
193-
},
194-
"json": {
195-
"name": "Alex"
196-
},
197-
"origin": "0.0.0.0",
198-
"url": "https://httpbin.org/post"
199-
}
170+
{
171+
"args": {},
172+
"headers": {
173+
"Accept-Encoding": "gzip",
174+
"Host": "httpbin.org",
175+
"User-Agent": "go-resty/2.4.0 (https://github.com/go-resty/resty)",
176+
"X-Amzn-Trace-Id": "Root=1-5f5ff031-000ff6292204aa6898e4de49"
177+
},
178+
"origin": "0.0.0.0",
179+
"url": "https://httpbin.org/get"
180+
}
200181
201182
Request Trace Info:
202183
DNSLookup : 4.074657ms
@@ -576,6 +557,30 @@ client.OnError(func(req *resty.Request, err error) {
576557
})
577558
```
578559

560+
#### Generate CURL Command
561+
>Refer: [curl_cmd_test.go](https://github.com/go-resty/resty/blob/v2/curl_cmd_test.go)
562+
563+
```go
564+
// Create a Resty Client
565+
client := resty.New()
566+
567+
resp, err := client.R().
568+
SetDebug(true).
569+
EnableGenerateCurlOnDebug(). // CURL command generated when debug mode enabled with this option
570+
SetBody(map[string]string{"name": "Alex"}).
571+
Post("https://httpbin.org/post")
572+
573+
curlCmdExecuted := resp.Request.GenerateCurlCommand()
574+
575+
// Explore curl command
576+
fmt.Println("Curl Command:\n ", curlCmdExecuted+"\n")
577+
578+
/* Output
579+
Curl Command:
580+
curl -X POST -H 'Content-Type: application/json' -H 'User-Agent: go-resty/2.14.0 (https://github.com/go-resty/resty)' -d '{"name":"Alex"}' https://httpbin.org/post
581+
*/
582+
```
583+
579584
#### Redirect Policy
580585

581586
Resty provides few ready to use redirect policy(s) also it supports multiple policies together.

resty.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
// Version # of resty
17-
const Version = "2.14.0"
17+
const Version = "2.15.0"
1818

1919
// New method creates a new Resty client.
2020
func New() *Client {

0 commit comments

Comments
 (0)