Permalink
Browse files

Make Rack::Auth handlers compatible with Rack::ShowStatus

darcs-hash:20070403201720-5d7f7-94eac54327fa04f61552b8fa5de2b1eb81b3886b.gz
  • Loading branch information...
tim committed Apr 3, 2007
1 parent 6e640a6 commit 9879a298bd9b2b42c55f10883d7d844703b8e2a2
Showing with 5 additions and 8 deletions.
  1. +2 −6 lib/rack/auth/abstract/handler.rb
  2. +2 −1 test/spec_rack_auth_basic.rb
  3. +1 −1 test/spec_rack_auth_digest.rb
@@ -9,15 +9,11 @@ def initialize(app, &authenticator)
end
def unauthorized(www_authenticate = challenge)
- headers = {
- 'Content-Type' => 'text/html',
- 'WWW-Authenticate' => www_authenticate.to_s
- }
- return [ 401, headers, ['<h1>401 Unauthorized</h1>'] ]
+ return [ 401, { 'WWW-Authenticate' => www_authenticate.to_s }, [] ]
end
def bad_request
- [ 400, { 'Content-Type' => 'text/html' }, ['<h1>400 Bad Request</h1>'] ]
+ [ 400, {}, [] ]
end
end
@@ -1,5 +1,6 @@
require 'test/spec'
require 'base64'
+require 'rack'
context 'Rack::Auth::Basic' do
@@ -34,7 +35,7 @@ def assert_basic_auth_challenge(response)
response.status.should.equal 401
response.should.include 'WWW-Authenticate'
response.headers['WWW-Authenticate'].should =~ /Basic realm="/
- response.should =~ /401 Unauthorized/
+ response.body.should.be.empty
end
specify 'should challenge correctly when no credentials are specified' do
@@ -90,7 +90,7 @@ def assert_digest_auth_challenge(response)
response.status.should.equal 401
response.should.include 'WWW-Authenticate'
response.headers['WWW-Authenticate'].should =~ /^Digest /
- response.should =~ /401 Unauthorized/
+ response.body.should.be.empty
end
def assert_bad_request(response)

0 comments on commit 9879a29

Please sign in to comment.