繁体   English   中英

400 Bad Request Nestful Ruby

[英]400 Bad Request Nestful Ruby

我正在尝试使用Pocket API授权我的应用程序。 因此,我正在使用Nestful发送HTTP请求。 每当我尝试发送请求时,都会收到400 Bad Request Pocket文档说它可能是缺少的使用者密钥或缺少的重定向URL。

但是,现在我正在查看Chrome中的“网络”标签,其中显示500内部服务错误。 这些是什么东西,我该如何解决?

我的代码:

require "nestful"
require "sinatra"
require "uri"

get '/' do
  params = {
    :consumer_key => '******************************', 
    :redirect_uri => 'http://localhost:4567/callback'
  }    

  response = Nestful.post 'https://www.getpocket.com/v3/oauth/request',
                :params => params,   
                :format => :json
 response.body
 response.headers

end

get '/callback' do
  "hello world"
end

因此我得到了有关我的问题的帮助。 事实证明, params已经是一个哈希,因此我不必说:params => params因为那将是多余的。

之前

response = Nestful.post 'https://www.getpocket.com/v3/oauth/request',
            :params => params,   
            :format => :json

response = Nestful.post 'https://getpocket.com/v3/oauth/request',
                params,   
                :format => :json

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM