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

Golang “net/http” DetectContentType error

Use DetectContentType to detect the uploaded file content-type, but the result is always application/octet-stream.this is just the default return in this function. So what's the problem?
lindsay show
  • 1,571
  • 2
  • 9
  • 6
0
votes
1 answer

Get data from access token

How do you get the data from the access token? It looks like I get the data encrypted. Do I need an key to decrypt it? Here's the sample of the code. x = Net::HTTP.post_form(URI.parse('http://www.asite.com/getinfo'), params) @response =…
user2974739
  • 619
  • 1
  • 7
  • 20
0
votes
1 answer

In RoR, how do I get the params set in a Net::Http::Post request?

I’m using Rails 4.2.7. How do I get the params that were set in a Net::HTTP::Post request? I have tried this in my Rails console 2.3.0 :001 > url = "https://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP/Post.html" =>…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

How do I programmatically anonymize my http GET request?

I’m using Rails 4.2.7. I have the following code that uses Net::HTTP to get a web page http = Net::HTTP.new(host, 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE path = '/' resp, data = http.get(path, nil) What I want to do…
user6447029
0
votes
1 answer

Ruby: Recording HTTP requests inside a custom method

I'm trying to custom record http requests. The idea is to define a function in which a request is logged. recorded :get, :post, :patch, :delete do Net::HTTP.get(URI('http://www.google.com')) #will…
Alex. b
  • 669
  • 2
  • 10
  • 18
0
votes
1 answer

How to use Net::HTTP's `get_print` method

I'm trying to create and initialize an instance of Net::HTTP as HTTPClient. When I get to the get_print method, though, it is telling me that it doesn't exist. What am I doing incorrectly? require 'Net/HTTP' print "Enter address for HTTP request:…
user2465510
  • 99
  • 10
0
votes
1 answer

Rails - sending multiple http requests to a another server

1000 users make a request to my Rails server at exactly the same time. For each user, I need to make 50 http requests to other servers, each taking 1 second to respond. How do I go about coding my application so that I can respond to the users as…
Vorpulus Lyphane
  • 660
  • 6
  • 19
0
votes
1 answer

How to solve HTTP Temporary Redirect error in using 'net/http' in ruby?

This following code continuously gives me # error. I tried to look at Ruby - net/http - following redirects, but of no use. require 'uri' require 'net/http' require 'json' uri =…
Saurabh Shah
  • 576
  • 1
  • 5
  • 19
0
votes
1 answer

Net::HTTP failing on a head request

I'm trying to make an HTTP Head request using Net::HTTP. require 'net/http' uri = URI("https://github.com/rails/rails") http = Net::HTTP.new(uri.host, uri.port) request = http.head(uri) puts request fails. AFAICT, this is because Net::HTTP is…
Buck Shlegeris
  • 517
  • 6
  • 22
0
votes
1 answer

Microsoft Emotion API for Video Operation Result Not Found - Rails

I'm working with the Microsoft Emotion API for processing emotions in video in a Rails app. I was able to make the call to the API to submit an operation, but now I have to query another API to get the status of the operation and once it's done it…
0
votes
0 answers

Ruby Net::HTTP.start calling a URL twice

I am trying to hit a URL in Ruby with the following code: begin Net::HTTP.start(uri.host, uri.port, :read_timeout=>5) do |http| request = Net::HTTP::Get.new uri.request_uri @response = http.request request @responsecode =…
Himanshu Kansal
  • 510
  • 7
  • 17
0
votes
2 answers

Checking existence of URL in Rails using Ruby's Net::HTTP class, not working for certain URLs that exist

So I wanted to implement a function that basically checks to see if a URL that is entered in a search box exists. My app takes the URL and uses the Net::HTTP class to send a request to the URL and check to see if the HTTP status code is 200. The…
PCR
  • 265
  • 1
  • 5
  • 14
0
votes
1 answer

net/http PUT with body causes problems

I want to use the Cloudera API from ruby. Therefore I want to update the configuration of the cloudera manager, which is done with an HTTP PUT request containing some json data. The URL is http://localhost:7180/api/v11/cm/config, my first approach…
Adracus
  • 891
  • 1
  • 7
  • 19
0
votes
1 answer

Unable to pull complete header from external URL in Ruby on Rails app

Background: The rails app I'm working on opens up articles from other websites in an iframe. But some publisher websites (like pitchfork.com, vox.com, medium.com) prevent themselves from opening in iframes by setting "X-Frame-Options: SAMEORIGIN" in…
drajan
  • 45
  • 7
0
votes
0 answers

Get HTTPBadRequest 400 with ruby net/http

I'm trying to write a Chatbot in Ruby. I'm currently facing a problem with the http request. Is this even the right way to do a request or do I have to search my fault in an other section of the code? I'm also using a proxy, could this affect the…
aha364636
  • 365
  • 5
  • 23