|
4 | 4 | <p align="center"><a href="#features">Features</a> section describes in detail about Resty capabilities</p>
|
5 | 5 | </p>
|
6 | 6 | <p align="center">
|
7 |
| -<p align="center"><a href="#"><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.6.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.7.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> |
8 | 8 | </p>
|
9 | 9 | <p align="center">
|
10 | 10 | <h4 align="center">Resty Communication Channels</h4>
|
|
13 | 13 |
|
14 | 14 | ## News
|
15 | 15 |
|
16 |
| - * v2.6.0 [released](https://github.com/go-resty/resty/releases/tag/v2.6.0) and tagged on Apr 09, 2021. |
| 16 | + * v2.7.0 [released](https://github.com/go-resty/resty/releases/tag/v2.7.0) and tagged on Nov 03, 2021. |
17 | 17 | * v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019.
|
18 | 18 | * v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
|
19 | 19 | * 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).
|
|
36 | 36 | - Success scenario [Request.SetResult()](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.SetResult) and [Response.Result()](https://pkg.go.dev/github.com/go-resty/resty/v2#Response.Result).
|
37 | 37 | - Error scenario [Request.SetError()](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.SetError) and [Response.Error()](https://pkg.go.dev/github.com/go-resty/resty/v2#Response.Error).
|
38 | 38 | - Supports [RFC7807](https://tools.ietf.org/html/rfc7807) - `application/problem+json` & `application/problem+xml`
|
| 39 | + * Resty provides an option to override [JSON Marshal/Unmarshal and XML Marshal/Unmarshal](#override-json--xml-marshalunmarshal) |
39 | 40 | * Easy to upload one or more file(s) via `multipart/form-data`
|
40 | 41 | * Auto detects file content type
|
41 | 42 | * Request URL [Path Params (aka URI Params)](https://pkg.go.dev/github.com/go-resty/resty/v2#Request.SetPathParams)
|
@@ -107,7 +108,7 @@ Resty author also published following projects for Go Community.
|
107 | 108 |
|
108 | 109 | ```bash
|
109 | 110 | # Go Modules
|
110 |
| -require github.com/go-resty/resty/v2 v2.6.0 |
| 111 | +require github.com/go-resty/resty/v2 v2.7.0 |
111 | 112 | ```
|
112 | 113 |
|
113 | 114 | ## Usage
|
@@ -359,6 +360,24 @@ resp, err := client.R().
|
359 | 360 | Options("https://myapp.com/servers/nyc-dc-01")
|
360 | 361 | ```
|
361 | 362 |
|
| 363 | +#### Override JSON & XML Marshal/Unmarshal |
| 364 | + |
| 365 | +User could register choice of JSON/XML library into resty or write your own. By default resty registers standard `encoding/json` and `encoding/xml` respectively. |
| 366 | +```go |
| 367 | +// Example of registering json-iterator |
| 368 | +import jsoniter "github.com/json-iterator/go" |
| 369 | + |
| 370 | +json := jsoniter.ConfigCompatibleWithStandardLibrary |
| 371 | + |
| 372 | +client := resty.New() |
| 373 | +client.JSONMarshal = json.Marshal |
| 374 | +client.JSONUnmarshal = json.Unmarshal |
| 375 | + |
| 376 | +// similarly user could do for XML too with - |
| 377 | +client.XMLMarshal |
| 378 | +client.XMLUnmarshal |
| 379 | +``` |
| 380 | + |
362 | 381 | ### Multipart File(s) upload
|
363 | 382 |
|
364 | 383 | #### Using io.Reader
|
|
0 commit comments