Giter Club home page Giter Club logo

Comments (10)

bak1an avatar bak1an commented on May 14, 2024 1

@jeevatkm

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.

jeevatkm avatar jeevatkm commented on May 14, 2024

@bak1an I need a time to analyze and get back to you. However your description makes sense.

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

@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 and resty is using that internaly.
  • Timeout is applied in the http.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.

bak1an avatar bak1an commented on May 14, 2024

Let me take another look at this...

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

Sure, I will wait for your inputs.

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

Whenever you have inputs please let me know. Thanks.

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

@bak1an

Yes it's sounds good. Thank you.

from resty.

bak1an avatar bak1an commented on May 14, 2024

@jeevatkm Then I will make a PR for this around the end of the week. Thanks!

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

@bak1an working on PR #74 for this feature.

from resty.

jeevatkm avatar jeevatkm commented on May 14, 2024

Implementation is in #91, closing it.

from resty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.