NoMethodError: undefined method `strip' for hash while using httparty
NoMethodError: undefined method `strip' for hash while using httparty
我正在尝试使用 api post 请求创建内容,我正在使用 httparty gem.
def initialize(token)
@token = "Bearer kdkdkfvl"
end
def auth
{ AUTHORIZATION: @token }
end
response = HTTParty.post("url", :headers => { "Authorization" => auth}, :body => article)
当我 运行 我得到的代码时
NoMethodError: undefined method
strip' for #
`
我被困在这里。需要一些帮助
您正在传递一个散列,它需要一个字符串。
你想要这样的东西:
def auth
@token
end
我正在尝试使用 api post 请求创建内容,我正在使用 httparty gem.
def initialize(token)
@token = "Bearer kdkdkfvl"
end
def auth
{ AUTHORIZATION: @token }
end
response = HTTParty.post("url", :headers => { "Authorization" => auth}, :body => article)
当我 运行 我得到的代码时
NoMethodError: undefined method
strip' for #
`
我被困在这里。需要一些帮助
您正在传递一个散列,它需要一个字符串。
你想要这样的东西:
def auth
@token
end