我有以下类执行一些请求:
- 第一个请求使用摘要身份验证
- 第二个请求使用基本身份验证
当我运行第二个请求时,出现以下错误:
only one authentication method, :basic_auth or :digest_auth may be used at a time
如何digest_auth
在运行第二个请求之前使之前无效?
class Test
include HTTParty
debug_output $stdout
digest_auth 'login', 'pass'
def first_request(href)
self.class.base_uri "SERVER:PORT"
response = self.class.get(href, {:query => {}})
response
end
def second_request(href)
auth = {:username => "USERNAME", :password => "PASSWORD"}
options = { :body => xml_string, :basic_auth => auth }
response = self.class.post('', options)
response
end
end