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
2
votes
1 answer

Incorporating a Faraday POST request with Rails app. AJAX best?

I have managed to get Faraday making a POST request to a Google Calander from a .rb file. I'd like to use this functionality in my app to check Free/Busy responses on calendars before displaying a list of availble time slots to my user, after they…
William Stock
  • 63
  • 2
  • 6
2
votes
1 answer

Deploy on heroku with dpl not working with new farady version

My CI/CD on gitlab deploy code on heroku using dpl. It have been working like a charm until a new version of faraday (I guess it is the reason) is fetch. Here is what I had in my gitlab CI terminal when it worked (yesterday) : ... $ dpl…
Alexy
  • 780
  • 6
  • 22
2
votes
1 answer

How to set up the authorization header for NTLM in Faraday

I user Faraday Ruby library and don't understand how to set up authorization header for NTLM. Is it possible ?
user3517175
  • 363
  • 2
  • 14
2
votes
0 answers

Faraday::ConnectionFailed - Couldn't connect to server. Error after updating to rails 6

An ActiveAdmin page I'm working on worked well in rails 5. For rails 6 the update_attribute was deprecated, so I changed those to update instead. However, whenever I call update(:attribute => true) it comes up with this Faraday::ConnectionFailed -…
aye.son
  • 51
  • 5
2
votes
0 answers

Ruby/Faraday: How to translate and parse response body?

I'm using Faraday gem for API connection. The body of the response from my call looks this way: "\xEF\xBB\xBF{\r\n "uptime": "112795",\r\n "started_at": "2021-32-14 17:32:11",\r\n "version": "2.0.4",\r\n "screens": [\r\n {\r\n "index":…
andrzej541
  • 919
  • 1
  • 9
  • 21
2
votes
1 answer

How do I retrieve the response.URL using Faraday gem?

I'm using Faraday to check for broken links, and I want to retrieve the response.URL of the links I'm querying, however, I am not able to find any documentation and examples to do so. I was able to do this on the front-end using Javascript's Fetch…
iamleftclick
  • 63
  • 1
  • 9
2
votes
2 answers

Unexpected behaviour with Faraday::ConnectionFailed

I'm writing a client for an API that rescue from Faraday::ConnectionFailed and Faraday::TimeoutError to retry the same method MAX_RETRIES times. This is the main method involved: def benchmark_request(path) retries ||= 0 request_start_time =…
ngw
  • 1,222
  • 1
  • 14
  • 34
2
votes
1 answer

How to enable logging bodies in Faraday

How to enable the logging of the request body by Faraday? Especially, I want to know the quick way to dump the body, header to stdout.
Kai Sasaki
  • 667
  • 4
  • 13
2
votes
2 answers

I keep receiving bad status codes (400, 401, 403) when making a request to the GitHub API via Faraday

I'm working on a little Ruby program to collect GitHub URLs from my Pocket account and then star those repos on my GitHub account. I've been able to connect to Pocket's API and get the URLs from my feed, but I'm having trouble with my requests to…
JRiggles
  • 4,847
  • 1
  • 12
  • 27
2
votes
1 answer

Invalid sign error on okex api v3 authenticated request

I try to send authenticated request to new okex api. part of their documentation: Creating a Request All REST requests must contain the following headers: OK-ACCESS-KEY The api key as a string. OK-ACCESS-SIGN The base64-encoded signature (see…
Gleb Omarov
  • 45
  • 1
  • 9
2
votes
1 answer

Parsing UTF-8 with Faraday

I'm making an API request with Faraday in Ruby and I'm parsing it with JSON.parse. The problem is that, the JSON response has sentences such as Longitud de la estaci\u00F3n meteorol\u00F3gica (grados) but it should be Longitud de la estación…
noloman
  • 11,411
  • 20
  • 82
  • 129
2
votes
0 answers

Uploading an image file with Faraday as an attachment to a Zendesk comment

I'm able to submit both the ticket and the file attachment, but when I try to open the uploaded image with the image viewer I get this error Error interpreting JPEG image file (Not a JPEG file: starts with 0x2d 0x2d) and the console output while…
2
votes
2 answers

Faraday TokenAuthentication

I am trying to use pure ruby, active_record, her, and faraday to access a REST API. Currently I have two methods I am attempting: ▶ cat lib/auth.rb class MyTokenAuthentication < Faraday::Middleware def call(env) …
Bryan Taylor
  • 31
  • 1
  • 3
2
votes
1 answer

adding params in faraday middleware

I am trying to write a middleware that will set additional params to the query string. The use case is to be able to add additional authentication tokens, for eg, to the request as required by the backend, but wanting to inject it independent of the…
gentwo
  • 113
  • 9
2
votes
1 answer

How to simulate Request Timeout in rspec with faraday

I use Faraday gem in app, and I want to test how my app works when Faraday connection fails by timeout. How can I stub request for this case?
pustserg
  • 141
  • 1
  • 5