我的代码抛出了一个错误,但我不知道为什么会发生这个错误
require 'rest_client'
response = RestClient.get 'http://example.com/resource'
puts response.code
输出:
i.rb:3:in `<main>': uninitialized constant RestClient (NameError)
确保您使用的是"rest-client"gem,而不是"restclient"。