mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Merge pull request #448 from commel/master
This fixes the nil error and enables to read the reponse again.
This commit is contained in:
commit
039cd23b8a
2 changed files with 20 additions and 2 deletions
|
@ -68,8 +68,10 @@ module Net
|
|||
|
||||
header =~ /Digest (.*)/
|
||||
params = {}
|
||||
non_quoted = $1.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
|
||||
non_quoted.gsub(/(\w+)=([^,]*)/) { params[$1] = $2 }
|
||||
if $1
|
||||
non_quoted = $1.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
|
||||
non_quoted.gsub(/(\w+)=([^,]*)/) { params[$1] = $2 }
|
||||
end
|
||||
params
|
||||
end
|
||||
|
||||
|
|
|
@ -152,6 +152,22 @@ RSpec.describe Net::HTTPHeader::DigestAuthenticator do
|
|||
end
|
||||
end
|
||||
|
||||
context "with http basic auth response when net digest auth expected" do
|
||||
it "should not fail" do
|
||||
# fails already so it is defined here
|
||||
begin
|
||||
@digest = setup_digest({
|
||||
'www-authenticate' => 'WWW-Authenticate: Basic realm="testrealm.com""'
|
||||
})
|
||||
|
||||
expect(authorization_header).to include("Digest")
|
||||
rescue => e
|
||||
fail "Should not fail on different authentification method"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple authenticate headers" do
|
||||
before do
|
||||
@digest = setup_digest({
|
||||
|
|
Loading…
Reference in a new issue