Questions tagged [net-http]

An HTTP client API for Ruby. Net::HTTP provides a rich library which can be used to build HTTP user-agents.

450 questions
0
votes
1 answer

Net::HTTP Proxy list

I understand that you could use proxy in the ruby Net::HTTP. However, I have no idea how to do this with a bunch of proxy. I need the Net::HTTP to change to another proxy and send another post request after every post request. Also, is it possible…
Adam Tan
  • 1
  • 1
0
votes
0 answers

Ruby Net:HTTP::Get weird behavior with JSON

I am using Net::HTTP for sending GET request to an API Server to fetch some data based on some configurations as below: # method to fetch shirt sample details from api server def fetch_shirt_sample(shirt, query_params) path =…
Dhanu Gurung
  • 8,480
  • 10
  • 47
  • 60
0
votes
1 answer

How to Inspect/Debug/View etc a request Generated by RestClient?

I have a really weird problem where when i try to access a URL using RestClient it times out. If i access the URL directly from the shell (using curl) it loads fine. I can get to other URLs, like google, via RestClient. Furthermore, if i use…
SharkLaser
  • 713
  • 1
  • 10
  • 19
0
votes
1 answer

Optimizing HTTP Status Request on Heroku (Net:HTTP)

I'm running an app on heroku where users can get the HTTP status (200,301,404, etc) of several URLs that they can paste on a form. Although it runs fine on my local rails server, when I upload it on heroku, I cannot check more than 30 URLs (I want…
Sharethefun
  • 804
  • 3
  • 17
  • 33
0
votes
1 answer

Ruby's Net::HTTP doesn't get the right answer from google OAuth server

I'm writing a small cli tool, that should check my calendar and do some stuff according to my appointments. I'm struggling a little bit with the OAuth2 authentication. I've checked the scope and the client_id with the curl tool like this: curl -d…
Shimu
  • 1,137
  • 11
  • 25
0
votes
2 answers

How do I sent a GET with query parameters in ruby's net/http 1.9.3-p194?

I'm trying to send a GET to http://www.hello.com/sup?a=b in ruby 1.9.3-p194 (can't update the version due to legacy code) uri = URI.parse("http://www.hello.com/sup?a=b") uri.query = "a=b" req = Net::HTTP::Get.new(uri) response =…
Popcorn
  • 5,188
  • 12
  • 54
  • 87
0
votes
1 answer

Net::HTTP DELETE call with a proxy not working (But get does)

I try to do a DELETE with Net::HTTP with a proxy and a digest password. Everything is working fine without the proxy or if it's a GET. Any ideas what I'm doing wrong and how to do it? This code with a get is working fine. h = Net::HTTP.new uri.host,…
0
votes
1 answer

How to display a users' twitter timeline on rails

I'm trying to display my own twitter timeline on my website, i've created code that works fine on the console but when I try to do this on my application I get the whole response body rather than just the tweets' text. P.S. I'm trying to do this…
gimiarn1801
  • 131
  • 2
  • 7
0
votes
0 answers

Intermittent blank Net:HTTP.get_response in rails

My rails app is experiencing something that has me confused. A few pages in the Rails app render content from another domain using Net::HTTP.get_resonse. So, alpha.example.com/pages/terms displays content received from www.example.com/terms. render…
sman591
  • 540
  • 6
  • 19
0
votes
0 answers

How to solve net http internal server error

I am passing xml data from an xml for post_xml to a web service which reads this data but am getting an error # my passing method is as below. What am I missing out or how shoul i go about it. Thank you require 'net/http' require…
Becka
  • 124
  • 1
  • 11
0
votes
1 answer

What is Net::HTTP doing differently than executing curl in ruby?

I have methods that GETs a resource from an external Rails server via JSON. One uses the net/http library, the other executes curl. They respond differently. If I use net/http def get_via_nethttp(endpoint, user, password, id) uri =…
Ron
  • 1,166
  • 5
  • 15
0
votes
1 answer

Having problems translating a curl command to Ruby Net::HTTP

This is a call to a Usergrid-stack web app to create a new application: curl -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -X POST -d '{ "name":"myapp" }' \ http://
Miriam H.
  • 671
  • 2
  • 8
  • 25
0
votes
1 answer

How to match 'with' in rspec if it's a complex object

I do the following: class FakeResponse def body 'access_token=token' end end Net::HTTP.stub(:get_response).and_return(FakeResponse.new) This works fine, but I want as well test, what's the requested URL. So I do url =…
shredding
  • 5,374
  • 3
  • 46
  • 77
0
votes
3 answers

Download a dmg file by http link

I am trying to download a .dmg file over the http link using ruby script. I have tried NET::HTTP and HTTParty methods described at http://www.ruby-doc.org/stdlib-2.0.0/libdoc/net/http/rdoc/Net/HTTP.html These methods work well with images and other…
CtrlV
  • 115
  • 11
0
votes
2 answers

How can I use Sinatra to simulate a remote server in RSpec / VCR?

The VCR Cucumber documents show many examples using a tiny Sinatra app to simulate a remote server, using a function called start_sinatra_app loaded from vcr_cucumber_helpers.rb. I'd like use something like that for my Rails / RSpec / VCR testing,…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217