0
考慮下面的代碼...Net :: HTTP :: Unauthorized - 我如何獲得WWW-Authenticate頭文件?
Net::HTTP.start('localhost', 4000) do |http|
#
# usual stuff omitted for clarity
#
@response = http.request(req)
end
...如果(很乖)服務器返回401(未授權)響應,我怎麼在WWW_Authenticate頭?
我已經得到了最好的解決方案是不是所有的好...
class Net::HTTPUnauthorized
def get_header(h)
_return = nil
target = h.upcase
self.header.each_header do |k, v|
if k.upcase == target
_return = v
break
end
end
_return
end
end
克里斯