How to debug/display request sent using RestClient

前端 未结 5 1394
执念已碎
执念已碎 2021-02-03 18:37

I am trying to use RestClient to access a webservice using post method. I am sending the authorization token as specified but I am still getting a 403 status error which means I

5条回答
  •  耶瑟儿~
    2021-02-03 19:23

    You can also get the request from the exception:

    def bla(token)
      response = RestClient.post "https://api-dev.xxx.com/software/services/search/ABC", :authorization => "Bearer #{token}"
    rescue RestClient::Exception => e
       @logger.error "#{e.response.request.inspect}"
    end 
    

提交回复
热议问题