Questions tagged [faraday]

Simple, but flexible HTTP client library, with support for multiple backends.

Faraday is an HTTP client lib that provides a common interface over many adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle.

271 questions
1
vote
0 answers

rails - API responses uncacheble

I am developing a web app that communicates to the API. In order to boost up the performance I am trying to implement HTTP caching with Faraday. At first, I've tried the standard :memory_cache: @conn = Faraday.new(url: URL) do |builder| …
mityakoval
  • 888
  • 3
  • 12
  • 26
1
vote
1 answer

Can I have Faraday HTTP cache respond with cache when origin is down?

Is it possible to have the faraday-http-cache middleware return a cached resource when the origin is down, sort of like what Cloudflare does? I ask because our Rails application is currently doubling as a sort of shared cache for our CMS's REST API…
jajavoli
  • 63
  • 2
  • 7
1
vote
1 answer

Retry POST request on 202 response - Faraday gem

I need Faraday to retry my POST request every time when it gets 202 http status as a response. I am aware of this module, yet I don't really get how to make use of it, since 202 doesn't throw an error or something and retry_if: block is not called…
Yaroslav V.
  • 121
  • 2
  • 8
1
vote
1 answer

Rspec: Getting Omniauth/oauth0 working with a Faraday Request

I am trying to test a graphql request with Faraday, but I first need to authenticate with omniauth/auth0. I got it to authenticate by setting def sign_in(user, invalid=false, strategy = :auth0) invalid ? mock_invalid_auth_hash :…
madav
  • 2,918
  • 1
  • 13
  • 17
1
vote
1 answer

rspec block return value

I have an issue that is extremely similar to a previously posted RSpec and Faraday question. To keep things clear, I'm going to borrow that other question's code and make a simple modification that is causing me much sorrow. class Gist def…
1
vote
1 answer

Faraday::ConnectionFailed (Failed to open TCP connection to api.arknode.net:4001

I am using ark-ruby gem and that code client = Ark::Client.new( :ip => 'api.arknode.net', :port => '4001', :nethash => '6e84d08bd299ed97c212c886c98a57e36545c8f5d645ca7eeae63a8bd62d8988', :version => '1.0.1' ) But it gives an error on heroku…
Haseeb Ahmad
  • 7,914
  • 12
  • 55
  • 133
1
vote
1 answer

Faraday is throwing an error "SSL_write:: shutdown while in init" randomly while calling one of Application API

I have two main applications(say App1, App2) sitting in different physical boxes. Each having their own microservices on their respective boxes. Now I am making a call from App1 to an API belonging to one of the microservices present for App2 on the…
Richa Sinha
  • 1,406
  • 15
  • 29
1
vote
0 answers

REST Authentication using Pronto Forms with RoR

I am new to the usage of remote REST APIs and was wondering if there was anyone who has any experience with connecting and using the REST API from Pronto Forms. Although this product offers examples using curl, there are no concrete examples…
panagioti
  • 426
  • 4
  • 14
1
vote
2 answers

Ruby on Rails - Faraday retry request if specific response?

I've been struggling with Faraday and my Ruby on Rails app. An API controller in Rails creates a Model instance and sends this data serialized in JSON to an external app that will process the data and send a response with float number inside its…
Doge
  • 315
  • 1
  • 8
  • 26
1
vote
1 answer

Ruby - Connect with SSL and authenticate via client certificate - sslv3 alert bad certificate

I'm trying to connect a webcrawler that accesses a certain site via SSL and queries my data on that site. The authentication of this site is via a self-signed Digital Certificate. At the moment I want to access the site, I upload this certificate in…
Matheus Porto
  • 169
  • 1
  • 5
1
vote
1 answer

Parsing HTTP multipart response body in Ruby (outside Rack)

I'm trying to use RestClient and Faraday to query an endpoint which returns multiple files in a multipart response. How do I parse the multipart envelopes in the response body? Rack::Utils::Multipart.parse_multipart would have done it, but in my…
Akshay Rawat
  • 4,714
  • 5
  • 40
  • 65
1
vote
1 answer

Faraday Gem Update locked because of Oauth2

I was trying to update Faraday Gem to 0.12.0. However, I ended up being as same since oauth2 gem has a dependency on Faraday (<0.10, >=0.8) [It says bundler has locked Faraday at 0.9.0] The "gem A" I wanted to install requires Faraday with version…
Sungpah Lee
  • 1,003
  • 1
  • 13
  • 31
1
vote
1 answer

Faraday::Error: :hashie is not registered on Faraday::Middleware

I am creating a wrapper gem for a RESTful API. I am getting following error when I try to add hashie middleware as per the documentation: Magpress::Login::#call#test_0001_should return valid JWT token: Faraday::Error: :hashie is not registered on…
Amit Patel
  • 15,609
  • 18
  • 68
  • 106
1
vote
3 answers

How to perform the following curl request using the ruby Faraday gem?

This is the curl request I'd like to perform: curl --request GET --url 'https://us8.api.mailchimp.com/3.0/' --user 'anystring:' Running this curl command from the command line, I get a bunch of JSON, which is what I want. I'm trying to…
FellyTone84
  • 665
  • 8
  • 18
1
vote
0 answers

Faraday post to localhost with json body always empty

Using ruby 2.3.1 I try to make a post request to a url on the localhost: conn = Faraday.new(:url => 'http://localhost:9393') do |faraday| faraday.adapter :excon # make requests with Net::HTTP faraday.response :json faraday.request…
Calin
  • 6,661
  • 7
  • 49
  • 80