Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mattia
    @iMacTia
    Hi @RuiSoares, apologies for the lack of documentation around certificates, the main reason is that they’re not too consistent beteween the different adapters. Assuming you’re using the default adapter (Net::HTTP), then you have a lot of properties supported: https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http.rb#L152
    You can provide them while creating the connection, for example if you need to set the ca_file you can do so like this
    conn = Faraday.new(…, ssl: { ca_file: ‘/path/to/the/ca.pem' })
    As for the exact value for ca_file, that mostly dipends on the adapter. For Net:HTTP it seems like a File or a file path should work, but different adapter (and thus libraries) this might be different
    Rui Soares
    @RuiSoares
    Hi @iMacTia, thank you. I will try that and get back to you with the outcome.
    Rui Soares
    @RuiSoares
    It worked, thanks a lot @iMacTia
    Mattia
    @iMacTia
    :tada:
    Matheus Santana
    @embs

    Hey guys, I got a question about exceptions handling in Faraday. When I try to request an unavailable address like

    Faraday.get('http://qweasdzxc.com')

    I get a Faraday::ConnectionFailedexception

    Faraday::ConnectionFailed (Failed to open TCP connection to qweasdzxc.com:80 (getaddrinfo: Name or service not known))

    But when I request localhost (or maybe any unavailable known hosts?) like in

    Faraday.get('http://localhost:9876')

    I get a SystemCallError exception:

    Errno::EADDRNOTAVAIL (Failed to open TCP connection to localhost:9876 (Cannot assign requested address - connect(2) for "localhost" port 9876))

    Should Faraday also wrap this exception?

    Thanks for this great library! :)

    Alexander Fisher
    @alexjfisher
    Hi! Thanks for the 0.17 release. This has fixed github-changelog-generator.
    One thing I discovered is that upgrading didn't fix the issue unless I also wiped (the presumably broken) http-cache directory it had been using with 0.16.x.
    tanaytatva
    @tanaytatva
    Hello guys, I i hope you are doing well ! I have a little problem
    with Faraday.new call
        response = Faraday.new(
          :url => settings['api_url'],
          ssl: {
            verify: false
          }).get("patients", params)
    when I add a certain parameter in params then response come with client_error = true
    and with some params it comes nil
    Any idea about this
    Mattia
    @iMacTia

    One thing I discovered is that upgrading didn't fix the issue unless I also wiped (the presumably broken) http-cache directory it had been using with 0.16.x.

    @alexjfisher I’ve already replied to you on GitHub, but for the sake of clarity a note have been added to the v0.17.0 release to highlight this :thumbsup:

    @embs sorry I missed your message! I’m trying to reproduce that issue on my Mac but I see a normal Faraday::ConnectionFailed exception being raised. Could you provide some additional information about your OS and if there’s something listening to that port?
    Hi @tanaytatva, I don’t see anything wrong with your code hosnestly. Where do you see the client_error = true exactly?
    Scott P
    @anithri
    Due to things beyond my control, I need to be able to make a post request that ends in '?secretkey==' without it being changed to '?secretkey=%3d' Is that at all possible?
    Scott P
    @anithri
    Add a custom Encoder and i'm working! Thanks for the nice software.
    Mattia
    @iMacTia
    Glad to hear everything is good 👍!
    rajeshwaruniversum
    @rajeshwaruniversum
    Hi How to close connection in faraday
    I tried by an object of Faraday::Connection
    by calling conn.close
    getting undefined method close which I am using version 0.17.0
    Mattia
    @iMacTia
    Hi @rajeshwaruniversum, close method have just been added to master branch (not released yet) and so far has not been implemented in any adapter yet: lostisland/faraday#1069
    it’s still a WIP but hopefully will be available in the future! So I’m afraid for now you won’t be able to use it
    if you really really need it, you’ll have to use the master branch and add the close method implementation to the adapter you’re using
    Hope that helps
    rajeshwaruniversum
    @rajeshwaruniversum
    Hi Thanks for your comment
    that make sence
    I took master branch
    but how to add a close method to my adapter
     Faraday::Connection.new(url: url) do |faraday|
          faraday.request  :url_encoded
          faraday.response :logger
          faraday.adapter  Faraday.default_adapter
        end
    Mattia
    @iMacTia
    You’ll have to monkey patch the adapter and implement the method. If you’ve never monkey-patched, this is a good start: https://www.justinweiss.com/articles/3-ways-to-monkey-patch-without-making-a-mess/
    The aim is to add the method close to whichever adapter you’re using (default is Net::HTTP) and in that method, close the connection
    rajeshwaruniversum
    @rajeshwaruniversum
    Thanks will have look on this
    Rachel Lanman
    @RSR312-206
    does anyone know of a good way to test the retry option? Is there a way to see if an endpoint ends up being retried, and how many times?
    Mattia
    @iMacTia
    Depending on how you configured it (under which circumstances it should retry) then it might be easier or not. If we’re talking about unit tests then webmock is probably your best shot :)
    Rachel Lanman
    @RSR312-206
    @iMacTia it was just to see if it was working - not in a unit test. I see there is a retry_block which I was thinking I could write the env.status to a tmp file. Mainly just trying to get some feedback that it's working.
    Mattia
    @iMacTia
    Oh I see what you mean now! Yes that’s a good way to spot when requests have been retried :). You could also add the logger middleware to your stack, AFTER the retry middleware, to see multiple logs of the same request
    Rachel Lanman
    @RSR312-206
    is the logger middleware available on version 0.12.2?
    because retry_block is not
    Mattia
    @iMacTia
    Ah right, the latter it was introduced later.
    Yes, logger middleware has been around for years
    So pretty sure it’s available
    Rachel Lanman
    @RSR312-206
    cool - thank you
    side note, I can't upgrade faraday because omniauth-stripe-connect has a dependency which requires a version of Faraday less than 0.13.
    which is really annoying
    Mattia
    @iMacTia
    Interesting, not sure why they’d put such a limitation...
    Rachel Lanman
    @RSR312-206
    yeah I haven't had time to dig into why