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
5
votes
2 answers

What is the Ruby equivalent to this curl request?

I'm tring to post to an api. This example from the docs works in curl: curl -k -w %{http_code} -H "Content-Type:text/plain" -u user:pass --data-binary @filename https://server/url/here This is what I have tried with faraday: require…
Alex Takitani
  • 491
  • 5
  • 14
5
votes
1 answer

Faraday::Error::TimeoutError (Timeout::Error):

I am having an issue were I keep getting this timeout for Faraday. I don't know what the issue is. I could really use some help here. This failing on a redirect. I am not sure what is causing the issue. I have been trying to fix this for 4 whole…
doctorjnupe
  • 61
  • 2
  • 6
5
votes
1 answer

How to catch the Faraday::Error::ConnectionFailed exception with Faraday?

If I run an HTTP request from Faraday, while the network is not available (i.e. in a wifi environment or working offline), it would be nice to have something catching this exception by…
poseid
  • 6,986
  • 10
  • 48
  • 78
5
votes
3 answers

Ruby's Faraday - include the same param multiple times

I'm working against an API that forces me to send the same parameter's name multiple times to cascade different filtering criteria. So a sample api GET call looks like this: GET http://api.site.com/search?a=b1&a=b2&a=b3&a=c2 I'm using Faraday for…
sa125
  • 28,121
  • 38
  • 111
  • 153
4
votes
2 answers

Learning the Faraday Http Library

I've been interested lately in the Faraday Http client library. I don't see much in the area of documentation or tutorials and wanted to know if anyone knows of any tutorials, blog posts or talks that go into Faraday?
Trenell Galman
  • 101
  • 1
  • 5
4
votes
1 answer

Faraday Proxy - Connection Failed - End of File Reached

I am working with OAuth2 gem and am trying to configure it to make calls through a Proxy. I am encountering this error Faraday::ConnectionFailed: end of file reached and am not sure what I am doing wrong. I thought it was the certificate but I…
Ziyan Junaideen
  • 3,270
  • 7
  • 46
  • 71
4
votes
1 answer

How to add Faraday request body into Datadog tracing in a Rails app

I'm trying to configure Faraday tracing in a Rails application using Datadog. I've set up the Faraday -> Datadog connection: require 'faraday' require 'ddtrace' Datadog.configure do |c| c.use :faraday end Faraday.post("http://httpstat.us/200",…
zoo
  • 43
  • 1
  • 5
4
votes
1 answer

Faraday::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate))

I'm using Faraday gem(https://github.com/lostisland/faraday) to communicate with external JSON API. I'm using the SSL option because API is requiring this: ssl_crt = File.read(Jets.root.join('certs', 'test.crt')) ssl_key =…
Mateusz Urbański
  • 7,352
  • 15
  • 68
  • 133
4
votes
0 answers

Calling localhost with port 3000 from Faraday

Currently I have 2 micro services API,I am trying to test the connection between the two micro services API using Rspec(Ruby Spec), and using Ruby Faraday. When I Faraday.get "localhost:3000/api/v1" I am having these error: Failed to open TCP…
4
votes
2 answers

Faraday multipart request with json & file data

When trying to POST multipart data (file & json) with Faraday gem, remote server is not recognizing json data parameter and failing with validation error as it is required parameter. connection = Faraday.new(url:…
maximus ツ
  • 7,949
  • 3
  • 25
  • 54
4
votes
2 answers

converting a curl call to a faraday request

I have the following curl request - `curl --socks5 #{proxy} --connect-timeout 10 -H "Accept: application/json" #{url}` I want to write a faraday request instead of a curl call. I am doing this - faraday = Faraday.new("#{url}", ssl:{verify: false}…
user2851669
4
votes
1 answer

Determining success for a Faraday request

I've adopted some code which has like 5 or 6 Faraday requests inline and is my first time working with it. I am abstracting out to a module. This is the first time I am using this library and I currently have: module CoreService def…
timpone
  • 19,235
  • 36
  • 121
  • 211
4
votes
2 answers

Faraday middleware know when something was redirected

I'm using the following code to make a request and follow redirects: require 'faraday' require 'faraday_middleware' conn = Faraday.new() do |f| f.use FaradayMiddleware::FollowRedirects, limit: 5 f.adapter Faraday.default_adapter end resp =…
Russ Savage
  • 598
  • 4
  • 20
4
votes
1 answer

How do I POST XML using Faraday and receive response?

I am attempting to learn Ruby/Faraday. I need to POST XML to a RESTful web service and am confused on how to do this. I have a string containing the XML as follows: require "faraday" require "faraday_middleware" mystring = %&
Lee Z
  • 802
  • 2
  • 13
  • 39
4
votes
1 answer

post image with faraday as parameter

I have a old service and new service with images on it. I want to migrate the images from old to new. for that I need to get image from my old service and then post it to new sinatra service. I was able to post image in the format i want using…
goyalankit
  • 843
  • 8
  • 23
1 2
3
18 19