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

Why do I get errors with XML modified using Nokogiri?

I am having problems understanding Net::HTTP and Nokogiri. I have a large number of jobs on my Jenkins server. I have to periodically update the branch name on these jobs. Doing it from the UI is a cumbersome process so I decided to update the…
user2611581
  • 166
  • 2
  • 15
0
votes
1 answer

net/http request just coming back with 200's

I am using net/http in rails to get back the response codes from URL's with the following code; require "net/http" require "uri" class Status def initialize(url) @url = url end def get_status begin response.code rescue…
Stacker-flow
  • 1,251
  • 3
  • 19
  • 39
0
votes
1 answer

net/http hanging requests causing failure - RoR

I have a bit of code that checks the response code of a list of URL's and presents them back - I am having trouble with a few of URL's that are hanging which causes the application not load at all. How can I make the request to give up after 30…
Stacker-flow
  • 1,251
  • 3
  • 19
  • 39
0
votes
1 answer

syntax error, unexpected end-of-input, expecting keyword_end

I'm trying to write a simple program to parse JSON from the results of an API call. Very new to ruby and just can't figure this one out. Here's all the code: require "rubygems" require "json" require "net/http" require "uri" uri =…
prichey
  • 75
  • 1
  • 7
0
votes
3 answers

Using Net::HTTP, how can you store the url that you queried?

require 'net/http' require 'uri' @url = 'http://foobar.com' @query_string = {foo1: 'bar1', foo2: 'bar2'} @post_data = Net::HTTP.post_form(URI.parse(@url), @query_string) @request = # ? How can I get the request URL + query? @response =…
MichaelHajuddah
  • 547
  • 5
  • 18
0
votes
1 answer

Output Net::HTTP request to human readable form

I am trying to debug a request that I am making to a server, but I can't figure out what is wrong with it, as it seems to be just like the request that I am putting through on RESTClient. I am initializing it like so: request =…
RileyE
  • 10,874
  • 13
  • 63
  • 106
0
votes
1 answer

SSL Error in net::HTTP.get

I'm trying to use ruby to do a search based on account 1234, but I keep getting an SSL_connect returned=1 errno=0 certificate error. The site is signed, but for some reason Ruby doesn't like it. The certificate is properly signed, so I'm not sure…
Jacobm001
  • 4,431
  • 4
  • 30
  • 51
0
votes
1 answer

unable to get the XML response using 'Get' request through 'Ruby' language

I am not able to get the xml response after triggering 'GET' request using Ruby language.My Current Code is as follows: require 'net/https' require 'uri' require 'base64' base_url = '' app_guid = '' format = "xml" # Example…
0
votes
1 answer

Net::HTTP adding port

I am doing an HTTP GET request but need to be able to add the port as it is not 80. Here is my code: response = Net::HTTP.get(URI.parse("http://#{@hs_host}/dir/testpage.asp?event=#{CGI::escape(event_name)}")) Which works perfect when the server is…
SeeleyBoothe
  • 261
  • 6
  • 18
0
votes
1 answer

How to rescue "sub" errors?

For example, I want to rescue from a Net::HTTP::Persistent::Error, however it has many types: Net::HTTP::Persistent::Error: too many connection resets (due to end of file reached - EOFError) Net::HTTP::Persistent::Error: too many connection resets…
mind.blank
  • 4,820
  • 3
  • 22
  • 49
0
votes
1 answer

net::http help [ POST works with curl but fails on the form]

I am trying to use net::http to do a post request. My request using net:http fails with following error: respnose_body,code: ["{\"message\":\"Validation Failed\",\"errors\":{\"direction\":[\"invalid\"]}}", "422"]] My request works fine using…
codeObserver
  • 6,521
  • 16
  • 76
  • 121
0
votes
0 answers

cannot find OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER

I have jruby 1.9 installed on a system and the OpenSSL::SSL::VERIFY_NONE works fine on it. I am trying to use the same code on a mac using rvm - ruby1.9.3 , ruby 1.8.7 and seems like its not working any more I get the error : undefined method…
codeObserver
  • 6,521
  • 16
  • 76
  • 121
0
votes
1 answer

Should I use Net::HTTP when I want to make POST request to an action

I have an action create and another action register_and_create. The first creates subscription and the seconds creates user and subscription. But I will have to copy the code of create action in register_and_create action. So is it good practice to…
Tsvetelina Borisova
  • 417
  • 1
  • 4
  • 14
0
votes
1 answer

Trouble with NET/HTTP post data

So, if I execute the following command, it works fine: curl -X POST --compressed -H "Content-Type:application/json" \ -H 'x-api-user: USER_ID' \ -H 'x-api-key: API_TOKEN' \ -d '{"text":"from the api!","type":"todo"}' \ …
0
votes
2 answers

The most super simple example to start woking with NetHTTP

In Rail my final goal is to write a Net::HTTP client to connect to my REST API that is returning JSON and parse it, pass it to View , etc.... But first things first! What is the simplest thing I can start with? I am looking at this…
user1899082