summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScytrin dai Kinthra <scytrin@gmail.com>2009-02-08 20:57:59 -0800
committerScytrin dai Kinthra <scytrin@gmail.com>2009-02-08 20:57:59 -0800
commit4d5485b52cf465f4a23e20e9ed35f453b5c3beff (patch)
treea8c812ad8f9836aaf7acb0d28be9b37429a8f0da
parent2a506e81922b0265ebfea135956c5e6234dfc64a (diff)
downloadrack-4d5485b52cf465f4a23e20e9ed35f453b5c3beff.tar.gz
Fix of Auth::Abstract::Handler to return headers within spec.
401 and 400 responses must have Content-Type and Content-Length defined.
-rw-r--r--lib/rack/auth/abstract/handler.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/rack/auth/abstract/handler.rb b/lib/rack/auth/abstract/handler.rb
index b213eac6..8489c9b9 100644
--- a/lib/rack/auth/abstract/handler.rb
+++ b/lib/rack/auth/abstract/handler.rb
@@ -16,11 +16,20 @@ module Rack
private
def unauthorized(www_authenticate = challenge)
- return [ 401, { 'WWW-Authenticate' => www_authenticate.to_s }, [] ]
+ return [ 401,
+ { 'Content-Type' => 'text/plain',
+ 'Content-Length' => '0',
+ 'WWW-Authenticate' => www_authenticate.to_s },
+ []
+ ]
end
def bad_request
- [ 400, {}, [] ]
+ return [ 400,
+ { 'Content-Type' => 'text/plain',
+ 'Content-Length' => '0' },
+ []
+ ]
end
end