You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple HTTP and REST client for Go inspired by Ruby rest-client. [Features](#features) section describes in detail about resty.
3
+
Simple HTTP and REST client for Go inspired by Ruby rest-client. [Features](#features) section describes in detail about resty capabilities.
4
4
5
-
***v0.5 released and tagged on Jan 03, 2016.***
5
+
***v0.6 released on Feb 03, 2016.***
6
6
7
7
#### Features
8
8
* GET, POST, PUT, DELETE, HEAD, PATCH and OPTIONS
9
9
* Simple and chainable methods for settings and request
10
10
* Request Body can be `string`, `[]byte`, `struct`, `map` and `io.Reader` too
11
-
* Auto detect`Content-Type`
12
-
* Response object gives you more possibility
11
+
* Auto detects`Content-Type`
12
+
*[Response](https://godoc.org/github.com/go-resty/resty#Response) object gives you more possibility
13
13
* Access as `[]byte` array - `response.Body()` OR Access as `string` - `response.String()`
14
14
* Know your `response.Time()` and when we `response.ReceivedAt()`
15
-
* Have a look [godoc](https://godoc.org/github.com/go-resty/resty#Response)
16
15
* Automatic marshal and unmarshal for `JSON` and `XML` content type
17
16
* Default is `JSON`, if you supply `struct/map` without header `Content-Type`
18
17
* Easy to upload one or more file(s) via `multipart/form-data`
19
-
*Client[Request](https://godoc.org/github.com/go-resty/resty#Client.OnBeforeRequest) and [Response](https://godoc.org/github.com/go-resty/resty#Client.OnAfterResponse) middlewares
18
+
*resty client[Request](https://godoc.org/github.com/go-resty/resty#Client.OnBeforeRequest) and [Response](https://godoc.org/github.com/go-resty/resty#Client.OnAfterResponse) middlewares
20
19
* Authorization option of `BasicAuth` and `Bearer` token
21
20
* Set request `ContentLength` value for all request or particular request
22
21
* Choose between HTTP and REST mode. Default is `REST`
23
-
*`HTTP` - default upto 10 redirects and no automatic response unmarshal
22
+
*`HTTP` - default up to 10 redirects and no automatic response unmarshal
24
23
*`REST` - defaults to no redirects and automatic response marshal/unmarshal for `JSON` & `XML`
25
24
* Custom [Root Certificates](https://godoc.org/github.com/go-resty/resty#Client.SetRootCertificate) and Client [Certificates](https://godoc.org/github.com/go-resty/resty#Client.SetCertificates)
26
25
* Download/Save HTTP response directly into File, like `curl -o` flag. See [SetOutputDirectory](https://godoc.org/github.com/go-resty/resty#Client.SetOutputDirectory) & [SetOutput](https://godoc.org/github.com/go-resty/resty#Request.SetOutput).
27
26
* Cookies for your request and CookieJar support
28
27
* Client settings like `Timeout`, `RedirectPolicy`, `Proxy`, `TLSClientConfig`, `Transport`, etc.
29
-
* Client API design
28
+
* Client API design
30
29
* Have client level settings & options and also override at Request level if you want to
31
30
* Create Multiple clients if want to `resty.New()`
32
31
* goroutine concurrent safe
@@ -42,7 +41,7 @@ resty tested with Go `v1.2` and above.
42
41
* FlexibleRedirectPolicy
43
42
* DomainCheckRedirectPolicy
44
43
* etc. [more info](redirect.go)
45
-
* etc (upcoming - throw your idea's via [issues](https://github.com/go-resty/resty/issues)).
44
+
* etc (upcoming - throw your idea's [here](https://github.com/go-resty/resty/issues)).
@@ -375,7 +374,7 @@ type CustomRedirectPolicy struct {
375
374
376
375
func(c *CustomRedirectPolicy) Apply(req *http.Request, via []*http.Request) error {
377
376
// Implement your logic here
378
-
377
+
379
378
// return nil for continue redirect otherwise return error to stop/prevent redirect
380
379
returnnil
381
380
}
@@ -431,7 +430,7 @@ resp, err := c.R().
431
430
resty.SetRESTMode()
432
431
433
432
// HTTP mode
434
-
resty.SetHTTPMode()
433
+
resty.SetHTTPMode()
435
434
```
436
435
437
436
#### Wanna Multiple Clients
@@ -527,7 +526,7 @@ resty releases versions according to [Semantic Versioning](http://semver.org)
527
526
528
527
`gopkg.in/resty.vX` points to appropriate tag versions; `X` denotes version number and it's a stable release. It's recommended to use version, for eg. `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. We aim to maintain backwards compatibility, but API's and behaviour might be changed to fix a bug.
529
528
530
-
529
+
531
530
## Contributing
532
531
Welcome! If you find any improvement or issue you want to fix, feel free to send a pull request, I like pull requests that include test cases for fix/enhancement. I have done my best to bring pretty good code coverage. Feel free to write tests.
0 commit comments