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

Why do I get 404 with a valid url using Net::HTTP.post_form?

I use the following code to pass data into a website: require "net/http" params = {"message"=>"some message", "to"=>"someone"} Net::HTTP.post_form(URI.parse("http://example.com/m/send"),params) When I inspect the web page, the form action is…
madgen
  • 747
  • 3
  • 15
1
vote
1 answer

How to use square brackets [] in URI in Ruby HTTP request

I am using an API that requires me to issue a request to a URL with one of the fields passed as an array. For…
chimeracoder
  • 20,648
  • 21
  • 60
  • 60
1
vote
1 answer

Requesting data from an API using Net::HTTP before a user logs in?

I'm trying to integrate my Ruby on Rails application with CheddarGetter using their hosted payment pages (http://support.cheddargetter.com/kb/hosted-payment-pages/hosted-payment-pages-setup-guide). I pretty much have everything figured out except…
cdotfeli
  • 309
  • 1
  • 4
  • 14
1
vote
2 answers

How set Header with Net::Http for Goo.gl Shorten service?

Like describe in API Goo.gl Manualy curl work perfectly : curl https://www.googleapis.com/urlshortener/v1/url \ -H 'Content-Type: application/json' \ -d '{"longUrl": "http://www.rubyinside.com/"}' Bu when i try to make this in Net::Http…
Joel AZEMAR
  • 2,506
  • 25
  • 31
1
vote
2 answers

How would I do a while statement with net/http if it keeps timing out?

I have the following code: require 'rubygems' require 'net/http' require 'uri' url = URI.parse('http://servername.tld/up.txt') response = Net::HTTP.get_response(url) @yes = response.body until @yes == "yes" puts "It's down" end The contents of…
jrg
  • 731
  • 1
  • 17
  • 34
1
vote
1 answer

How can I post xml data using net/http that also has data in the url

I am working with an api that requires me to post xml to url such as someapi.com?userID=123. Thus far, I have tried this (assume the xml is composed already in the xml variable): url = URI.parse('http://www.someapi.com/process_leads.asp') request =…
kidbrax
  • 2,364
  • 3
  • 30
  • 38
1
vote
2 answers

Post to a Url with a Querystring in Ruby

In Ruby, it doesn't appear that it's possible to POST to a URL that has a querystring using Net:HTTP. At least, in my tests it gets dropped, and there's a 3 year old discussion here about how it doesn't work. So, what's a decent way to go about it?…
Tom Lianza
  • 4,012
  • 4
  • 41
  • 50
1
vote
1 answer

"Faraday::ConnectionFailed: Broken pipe" when uploading Tempfile to S3 Presigned URL

In my Ruby on Rails application, I need to upload large (~30MB or greater) MP4 video assets to an Amazon S3 Presigned URL using the Faraday Ruby gem. This operation frequently fails with a Faraday::ConnectionFailed: Broken pipe error. I want to…
1
vote
2 answers

RESTful Rails controller ans net/http as client - slow on many requests

I have an Array populated with potentially lots of records. Every records shall be saved by the server in a RESTful RecordsController. My Solution in the moment looks like this: def self.send! options = nil records = fetch_records records.each…
GeorgieF
  • 2,687
  • 5
  • 29
  • 43
1
vote
1 answer

http.get randomly says "getaddrinfo: Name or service not known"

To generate offline reports, my Rails app needs to download charts from the Google Charts API. PROBLEM: It works fine most of the time, but sometimes (randomly) it fails and says getaddrinfo: Name or service not known When I get the error, I just…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
1
vote
2 answers

Cookies - I may be crazy with ruby/rails

Is it possible to login with net/http or curl, save the cookie response then write that cookie to the users browser so I can "push login" (in a sense)? Is there another way of doing this, is this even possible, or am I simply crazy? I'm aware of how…
jBeas
  • 926
  • 7
  • 20
1
vote
0 answers

Can we call ASP.Net page load function from Rails application?

I'm facing an issue while calling the ASP.Net function from Rails. First I want to know that Is it possible to call the ASP.Net function from Rails? I tried to call it but facing error message I…
1
vote
1 answer

Make a attendance table for students with Go

I'm trying to create a Student Attendance web app. Currently have a struct type Student struct { StudentID int StudentName string Created time.Time } All student will be listed on list.html func ListStudent(w http.ResponseWriter, r…
1
vote
0 answers

Gorilla websocket is not closing

I want to open websocket server whenever i want to and close but server does not close after writing "exit" when i go back to my main() and i try to start again it fails saying "httpHandleFunc multiple registration '/' " how do i close websocket…
1
vote
1 answer

Using Ruby on Rails to POST JSON/XML data to a web service

I built a web service in using Spring framework in Java and have it run on a tc server on localhost. I tested the web service using curl and it works. In other words, this curl command will post a new transaction to the web service. curl -X POST -H…
oky_sabeni
  • 7,672
  • 15
  • 65
  • 89