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

How do I check that the libraries I'm calling are configuring OpenSSL to properly verify a cert?

I'm making an API call out to an OAuth 2.0 provider over SSL. I know that it's been a common practice in Ruby in the past to set Net::HTTP#verify_mode to VERIFY_NONE, which is a bad thing to do. The Ruby libraries I'm using all call back to…
Eric Walker
  • 7,063
  • 3
  • 35
  • 38
1
vote
1 answer

How to build a proxy controller and faraday

I have to built an angular js application as a client to consume the api. The problem is that the api doesn't support jsonp calls. So I've created a rails application that makes the calls to the api and returns the content. I'm using the faraday gem…
Mihai
  • 1,254
  • 2
  • 15
  • 27
1
vote
2 answers

passing array of url params in faraday

I'm new to Faraday and trying to learn how to pass an array for url params. My code looks like this: require 'faraday' conn = Faraday.new(:url => 'http://foo.com:8888') do |faraday| faraday.request :url_encoded faraday.response :logger …
user139014
  • 1,445
  • 2
  • 19
  • 33
1
vote
1 answer

Send multiple files to a webservice

I'm currently trying to send multiple files to a webservice (and to proceed, depending on the response afterwards, but that's not where I am at yet). The following code sends one file: def show ... conn = Faraday.new(:url => 'webservice.abc'…
1
vote
1 answer

How do I pass debug and logging options through Faraday to Net::HTTP or Net::HTTPS

I'm using Faraday and Net::HTTP, Net::HTTPS to connect to a site using SSL. However I get the following error: 'SSL_connect returned=1 errno=0 state=SSLv3 read finished A: sslv3 alert handshake failure' How do I make Faraday turn on debugging and…
1
vote
1 answer

Rails session token available in model

I have a database-less rails app which communicates with an API. For authentication, I send the users credentials to the api and receive a session token if successful. Subsequently, every api request I make should contain that…
pws5068
  • 2,224
  • 4
  • 35
  • 49
1
vote
1 answer

How do I prevent Faraday from stripping the trailing slash from a URL?

I'm trying to use the Faraday gem (version 0.8.4) to interact with an external API. The API requires a trailing slash on the URL, e.g., https://api.example.com/1.2/. Here's the code I'm using to make the request: connection = Faraday.new(:url =>…
trliner
  • 459
  • 3
  • 11
1
vote
0 answers

Connect Rails application using Faraday to Java web service over HTTPS

First I will state what I am trying to do: I have a self-signed cert for development/test purposes being used by a Clojure/Jetty API that a Rails app needs to make requests to. I have no difficulty connecting to it in Clojure using clj-http, which…
rplevy
  • 5,393
  • 3
  • 32
  • 31
1
vote
3 answers

How to specify network interface with Ruby's Faraday?

I'm using Faraday which wraps various adapters, including Net::HTTP, Excon, Typhoeus, Patron, and EventMachine. I would like to specify the network interface (e.g. en0 or en1), but I'm not sure how or if it is possible. I'd be open to answers at the…
David J.
  • 31,569
  • 22
  • 122
  • 174
1
vote
2 answers

Rails integration tests with Faraday & Omniauth

My integration test looks like this: class OAuthTest < ActionDispatch::IntegrationTest ... @client = OAuth2::Client.new( client_id, …
Paweł Gościcki
  • 9,066
  • 5
  • 70
  • 81
0
votes
2 answers

is there a way to run two versions of the same gem within the same gem env

In my Gemfile I need gem lumberg and gem openai_chatgpt which both depend on gem faraday. However, lumberg depends on faraday pre v 2.0 and openai_chatgpt depends on faraday post v 2.0. Faraday 2.0+ was a significant change. The result is that the…
willyab
  • 167
  • 1
  • 10
0
votes
0 answers

How to resolve 'faraday-net_http requires Ruby version >= 2.6.0' error when installing fluent-plugin-elasticsearch?

I'm trying to run docker containers for EFK stack using docker compose. but it keeps throwing me this error : . I tried to install the specified version of faraday-net_http using this command : gem install faraday-net_http -v 2.1.0 and checked my…
0
votes
1 answer

Faraday Response is never JSON

I can never get a JSON response from Faraday, within Ruby 3.1.3 and Faraday 2.7.5: def connection @connection ||= Faraday.new( url: url, headers: headers ) do |faraday| faraday.response :json …
I. Khan
  • 169
  • 6
0
votes
2 answers

how save image using faraday

I have author class using active storage. class Author < ApplicationRecord has_one_attached :image end Here is my faraday connection conn = Faraday.new( url:…
Kashiftufail
  • 10,815
  • 11
  • 45
  • 79
0
votes
0 answers

[Ruby][Faraday] What is the correct way to handle paginated APIs

I have found a creative way to deal with paginated APIs when using faraday as an HTTP client. But I am pretty sure this is not the way it should be done. I had a look at the docs but did not find a proper solution. What is the correct way to handle…