Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test that multiple authorization headers function

  • Loading branch information...
commit 875be3784d8838dc65fa79753d1f09489f6ca53a 1 parent ddba90c
@jsternberg jsternberg authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 spec/httparty/net_digest_auth_spec.rb
View
37 spec/httparty/net_digest_auth_spec.rb
@@ -112,4 +112,41 @@ def authorization_header
authorization_header.should include(%Q(response="#{request_digest}"))
end
end
+
+ context "with multiple authenticate headers" do
+ before do
+ @digest = setup_digest({
+ 'www-authenticate' => 'NTLM, Digest realm="myhost@testrealm.com", nonce="NONCE", qop="auth"',
+ })
+ end
+
+ it "should set prefix" do
+ authorization_header.should =~ /^Digest /
+ end
+
+ it "should set username" do
+ authorization_header.should include(%Q(username="Mufasa"))
+ end
+
+ it "should set digest-uri" do
+ authorization_header.should include(%Q(uri="/dir/index.html"))
+ end
+
+ it "should set qop" do
+ authorization_header.should include(%Q(qop="auth"))
+ end
+
+ it "should set cnonce" do
+ authorization_header.should include(%Q(cnonce="md5(deadbeef)"))
+ end
+
+ it "should set nonce-count" do
+ authorization_header.should include(%Q(nc=00000001))
+ end
+
+ it "should set response" do
+ request_digest = "md5(md5(Mufasa:myhost@testrealm.com:Circle Of Life):NONCE:00000001:md5(deadbeef):auth:md5(GET:/dir/index.html))"
+ authorization_header.should include(%Q(response="#{request_digest}"))
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.