Ruby open_uri error NoMethodError: undefined method `strip' for 10:Fixnum
Ruby open_uri error NoMethodError: undefined method `strip' for 10:Fixnum
当我使用它时一切正常:
html = open("http://"+self.url).read
但是当我添加用户代理时:
html = open("http://"+self.url, "User-Agent" => "Ruby", 'read_timeout' => 10 ).read
我得到:
NoMethodError: undefined method `strip' for 10:Fixnum
from /Users/a_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/header.rb:17:in `block in initialize_http_header'
这里有什么问题?
当我使用它时一切正常:
html = open("http://"+self.url).read
但是当我添加用户代理时:
html = open("http://"+self.url, "User-Agent" => "Ruby", 'read_timeout' => 10 ).read
我得到:
NoMethodError: undefined method `strip' for 10:Fixnum
from /Users/a_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/header.rb:17:in `block in initialize_http_header'
这里有什么问题?