@request.headers["Authorization"] = "Token token=#{auth_token}"
post "/verify"
当我puts @request.inspect
时,我看到的唯一标题是:
..."action_controller.instance"=>
#<VerificationsController:0x007fc5683ebd38 @_routes=nil,
@_action_has_layout=true,
@_headers={"Content-Type"=>"text/html"}...
为什么我的授权标题没有显示?
答案 0 :(得分:3)
我最终得到了这个工作:
headers = { 'Authorization' => "Token token=\"#{auth_token}\"" }
json_body = {}
post "api/1.1/cartwheelregister/verify/answers", json_body, headers