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

rails faraday for API call Issue

I am getting a undefined method `body' error with a faraday call to an API; URL - https://api.company.com/api/v1/dept/person/query/empid/22435678 I need to pass a username and password through as well. Here is what I am trying. What am I doing…
spacerobot
  • 265
  • 1
  • 5
  • 23
1
vote
1 answer

Ruby Faraday gem adds Content-type when no body

I am using the Ruby Faraday gem to make some requests to the Bitstamp API. I want to make a this post request (to get my account balance) with an empty body. The problem that I'm having is that Faraday adds a Content-type header during the execution…
Federico
  • 13
  • 3
1
vote
1 answer

Specify client certificate with Ruby Typhoeus

I'm trying to use Typhoeus to make an HTTP request that requires a client certificate. The Typhoeus README does not mention using client certificates at all. The only discussion I could find about specifying a client certificate with Typhoeus is…
Brad Johnson
  • 113
  • 1
  • 7
1
vote
1 answer

Creating a cookie to send with faraday GET request

I am trying to trigger a GET request where I need to send two cookies (I obtain these through inspecting my browser cookies once I authenticate into my website) that authorises my request. However, when I try the below ruby code using the faraday…
Coderama
  • 11,050
  • 12
  • 44
  • 58
1
vote
0 answers

Replacement of HTTParty.send with Faraday

I am rails beginner working on a task to replace HTTParty with Faraday. So in codebase I call put/post/get based on the verb like so: response = HTTParty.send(verb, url, http_options) I am aware that Faraday provides an option to call them…
Rishi Katyal
  • 175
  • 5
  • 15
1
vote
3 answers

Docker Ruby SSL_connect returned=1 errno=0 state=error: wrong signature type

I have ruby 2.7 in a Docker container running a rather simple HTTP client using Faraday: conn = Faraday.new("https://jinio.com.ph") conn.post("/tracker", {p: @code}.to_json, {"Content-Type" => "application/json"}) This code returns a SSL Error…
brux
  • 29
  • 7
1
vote
1 answer

Rails how to save data upon creation with an external API?

In my app for bike_rental_shops, I'm making it possible for these shops to manage their bike rentals. Context Bike rental companies also offer their bikes on website of external parties, therefore I'm connecting my Rails application with these…
techquestion
  • 489
  • 5
  • 20
1
vote
1 answer

Elasticsearch::Transport::Transport::Errors::Forbidden: [403] error when sending text fields with more than 1200 characters

I am getting this message when I try to index using elasticsearch. I have tried both the elasticsearch-rails gem and searchkick gem. We are making creation and editing of e-courses online. Elasticsearch::Transport::Transport::Errors::Forbidden:…
1
vote
2 answers

Api response is an HTML redirect page, while I expect a JSON response

I'm using the Faraday gem to request some data from the LibreNMS API. But when i display the response body I get some HTML code that looks like a redirect page to the libreNMS login. I have the following code (BaseService class): def…
perkoei
  • 11
  • 1
1
vote
1 answer

enforcing Faraday adapter :typhoeus to use HTTP/2 for requests

How to enforce Faraday adapter typhoeus to use HTTP/2 for requests to servers which supported HTTP/2? I have tested this over service https://http2.pro/doc/api and result was like…
Aleks Boev
  • 630
  • 1
  • 7
  • 16
1
vote
1 answer

Faraday Json validation before .post

Currently using Faraday to do some http request to certain api. I want to validate the body + header at step of .post. However, when calling the .post the body is set and send. So! I was wondering if it is possible to setup a schema validation at…
1
vote
1 answer

Faraday gem not ungzipping response body

I'm experimenting with the UK NHS 'GP Connect' REST API and trying to wrap some of the connection complexity in a more simple Ruby layer. I've been successfully playing with the API via Postman and the responses are all correctly unzipped to…
1
vote
1 answer

How I can generate Faraday Timeout Error Manually in Ruby On Rails

I have a ruby on rails application which hit salesforce api and log the error. There are some scenarios where system is generate ReadNet Timeout error. I just wanted to generate the error manually so I can handle different logics in my code
Ayaz Ahmad Tarar
  • 534
  • 8
  • 24
1
vote
1 answer

I've got 404 error code if I replace value in a payload when using Faraday gem to call request

I am learning Ruby programming and I am building an API testing project. I have a request to a specific site and I am using Faraday gem. Here my code: conn = Faraday.new f_response = conn.post do |req| req.url 'https://api.abcxyz.vn/v2/tokens' …
1
vote
1 answer

Ruby within Python virtualenv HTTP Post Request very slow on the client side

I'm currently stuck with a response time problem with the Faraday HTTP library. I'm using the following code to initialize a POST request to a server running on my local machine at 127.0.0.1. The server returns a valid JSON string. The code to…
Krid
  • 269
  • 1
  • 3
  • 14