Comments (10)
Existing timeout, TLS and proxy resty interfaces are looking simple and solid so we definitely should keep them around without making anything there harder to use.
On the other hand, giving users ability to override RoundTripper
will provide the library with extra flexibility which is good thing to have as well.
The way to get this done I see at the moment is to provide users with SetRoundTripper
method on Client
along with documentation describing that tls/timeout/proxy methods will not work unless that RoundTripper
provided is not an http.Transport
. So it is more like "if you know what you are doing - have fun" kind of method.
And the proxy/timeout/tls methods stay with the same interface, they will just do type assertion on roundTripper
they have available and do nothing if it is not and http.Transport
(+ log the error like in https://github.com/go-resty/resty/blob/master/client.go#L535 to get user and idea that something is likely wrong).
Does this sound sane?
from resty.
@bak1an I need a time to analyze and get back to you. However your description makes sense.
from resty.
@bak1an I took longer than I expected to respond for your query.
I would like to give you a background. Since v0.11
release -
- After calling
SetTransport
method and then user calls any methods, those supplied values (Proxy
,TLS
, etc.) gets into the object they have supplied andresty
is using that internaly. Timeout
is applied in thehttp.Client.Timeout
Now let's get back to your question, whether adding support for http.RoundTripper
and keeping existing features intact would benefit resty
users? If answer is yes then please count me in.
Looking forward to your thoughts.
from resty.
Let me take another look at this...
from resty.
Sure, I will wait for your inputs.
from resty.
Whenever you have inputs please let me know. Thanks.
from resty.
Yes it's sounds good. Thank you.
from resty.
@jeevatkm Then I will make a PR for this around the end of the week. Thanks!
from resty.
@bak1an working on PR #74 for this feature.
from resty.
Implementation is in #91, closing it.
from resty.
Related Issues (20)
- Why TLS Timeout error can't be handle by Retries ? HOT 2
- Can I send a custom HTTP verb?
- Using it within a goroutine can cause inaccurate delay measurements returned by the Time function. HOT 2
- compilation fails with bazel in resty 2.8 HOT 4
- .SetTimeout() option breaks functionality, results in showing the duration of HTTP request wrong. HOT 5
- Add clone method in `Request`
- Unable to test Body() due to unexported variable body HOT 3
- Setting context for all request? HOT 6
- Problem with a client requesting a TCP service HOT 4
- [BUG] DigestAuth with SetBody will be 'http: ContentLength=54 with Body length 0' HOT 3
- SetResult replaces nested struct with a map inside a map HOT 2
- Resty client global variable HOT 1
- parseResponseBody > Unmarshalc cannot unmarshal string into Go value of type map[string]interface {}
- DATA RACE in resty's middleware (go-resty/resty/v2.releaseBuffer()) HOT 2
- What's the idiomatic way of changing proxies for the client? HOT 1
- Add support for go-logr/logr on resty HOT 1
- Is the `SetTimeout()` respected by the default context?
- Request body is written multiple times HOT 2
- Result value has been set and parsed correctly and the request returns successfully, the correct address cannot be recognized HOT 2
- support OnBeforeResponse HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resty.