0

The following code block is throwing an EOF error but only for the specified domain:

require 'net/http'

uri = URI("https://api.discogs.com/database/search?q=wilco&token=mDwvoRKQSSGmKpvvxXLrABZXzFbiggcqhPHxUEXl")
response = Net::HTTP.get(uri)

The error message I see is:

~/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock': end of file reached (EOFError)

I am able to curl the request without a hitch. I have tried using HTTParty, open-uri, and different versions of Ruby. I have also attempted the solutions mentioned here and here with no luck. Any help would be appreciated.

Community
  • 1
  • 1
Filipe
  • 3
  • 2

1 Answers1

-1

It's working with faraday library

require 'faraday'

url = 'https://api.discogs.com/database/search?q=wilco&token=mDwvoRKQSSGmKpvvxXLrABZXzFbiggcqhPHxUEXl'
response = Faraday.get url

puts response.body
Piotr Dawidiuk
  • 2,961
  • 1
  • 24
  • 33
  • It does indeed work. I was unfamiliar with Faraday. Excellent library. Thanks a bunch. I'm still unsure what was preventing net/http from working, but this got me over the hurdle I was in. – Filipe Feb 12 '17 at 21:49
  • @Filipe It looks like low-level, deep library error. – Piotr Dawidiuk Feb 13 '17 at 16:11