开源软件名称: go-resty/resty开源软件地址: https://github.com/go-resty/resty开源编程语言:
Go
99.1%
开源软件介绍:
Resty
Simple HTTP and REST client library for Go (inspired by Ruby rest-client)
Features section describes in detail about Resty capabilities
Resty Communication Channels
News
v2.7.0 released and tagged on Nov 03, 2021.
v2.0.0 released and tagged on Jul 16, 2019.
v1.12.0 released 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 .
Features
GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, etc.
Simple and chainable methods for settings and request
Request Body can be string
, []byte
, struct
, map
, slice
and io.Reader
too
Auto detects Content-Type
Buffer less processing for io.Reader
Native *http.Request
instance may be accessed during middleware and request execution via Request.RawRequest
Request Body can be read multiple times via Request.RawRequest.GetBody()
Response object gives you more possibility
Access as []byte
array - response.Body()
OR Access as string
- response.String()
Know your response.Time()
and when we response.ReceivedAt()
Automatic marshal and unmarshal for JSON
and XML
content type
Easy to upload one or more file(s) via multipart/form-data
Auto detects file content type
Request URL Path Params (aka URI Params)
Backoff Retry Mechanism with retry condition function reference
Resty client HTTP & REST Request and Response middlewares
Request.SetContext
supported
Authorization option of BasicAuth
and Bearer
token
Set request ContentLength
value for all request or particular request
Custom Root Certificates and Client Certificates
Download/Save HTTP response directly into File, like curl -o
flag. See SetOutputDirectory & SetOutput .
Cookies for your request and CookieJar support
SRV Record based request instead of Host URL
Client settings like Timeout
, RedirectPolicy
, Proxy
, TLSClientConfig
, Transport
, etc.
Optionally allows GET request with payload, see SetAllowGetMethodPayload
Supports registering external JSON library into resty, see how to use
Exposes Response reader without reading response (no auto-unmarshaling) if need be, see how to use
Option to specify expected Content-Type
when response Content-Type
header missing. Refer to #92
Resty design
Have client level settings & options and also override at Request level if you want to
Request and Response middleware
Create Multiple clients if you want to resty.New()
Supports http.RoundTripper
implementation, see SetTransport
goroutine concurrent safe
Resty Client trace, see Client.EnableTrace and Request.EnableTrace
Since v2.4.0, trace info contains a RequestAttempt
value, and the Request
object contains an Attempt
attribute
Debug mode - clean and informative logging presentation
Gzip - Go does it automatically also resty has fallback handling too
Works fine with HTTP/2
and HTTP/1.1
Bazel support
Easily mock Resty for testing, for e.g.
Well tested client library
Included Batteries
Redirect Policies - see how to use
NoRedirectPolicy
FlexibleRedirectPolicy
DomainCheckRedirectPolicy
etc. more info
Retry Mechanism how to use
Backoff Retry
Conditional Retry
Since v2.6.0, Retry Hooks - Client , Request
SRV Record based request instead of Host URL how to use
etc (upcoming - throw your idea's here ).
Supported Go Versions
Initially Resty started supporting go modules
since v1.10.0
release.
Starting Resty v2 and higher versions, it fully embraces go modules package release. It requires a Go version capable of understanding /vN
suffixed imports:
It might be beneficial for your project
请发表评论