Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add 205 Reset Content to the list of statuses without a message body

  • Loading branch information...
commit 2c5b076aaba6c83ffce8c6c2b5c49085c1abb5a5 1 parent c3219ea
@dkubb dkubb authored
View
4 SPEC
@@ -146,11 +146,11 @@ consisting of lines (for multiple header values, e.g. multiple
The lines must not contain characters below 037.
=== The Content-Type
There must be a <tt>Content-Type</tt>, except when the
-+Status+ is 1xx, 204 or 304, in which case there must be none
++Status+ is 1xx, 204, 205 or 304, in which case there must be none
given.
=== The Content-Length
There must not be a <tt>Content-Length</tt> header when the
-+Status+ is 1xx, 204 or 304.
++Status+ is 1xx, 204, 205 or 304.
=== The Body
The Body must respond to +each+
and must only yield String values.
View
4 lib/rack/lint.rb
@@ -464,7 +464,7 @@ def check_headers(header)
def check_content_type(status, headers)
headers.each { |key, value|
## There must be a <tt>Content-Type</tt>, except when the
- ## +Status+ is 1xx, 204 or 304, in which case there must be none
+ ## +Status+ is 1xx, 204, 205 or 304, in which case there must be none
## given.
if key.downcase == "content-type"
assert("Content-Type header found in #{status} response, not allowed") {
@@ -483,7 +483,7 @@ def check_content_length(status, headers)
headers.each { |key, value|
if key.downcase == 'content-length'
## There must not be a <tt>Content-Length</tt> header when the
- ## +Status+ is 1xx, 204 or 304.
+ ## +Status+ is 1xx, 204, 205 or 304.
assert("Content-Length header found in #{status} response, not allowed") {
not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
}
View
2  lib/rack/mock.rb
@@ -182,7 +182,7 @@ def body
end
def empty?
- [201, 204, 304].include? status
+ [201, 204, 205, 304].include? status
end
end
end
View
2  lib/rack/response.rb
@@ -71,7 +71,7 @@ def redirect(target, status=302)
def finish(&block)
@block = block
- if [204, 304].include?(status.to_i)
+ if [204, 205, 304].include?(status.to_i)
header.delete "Content-Type"
header.delete "Content-Length"
[status.to_i, header, []]
View
2  lib/rack/utils.rb
@@ -459,7 +459,7 @@ def replace(other)
}
# Responses with HTTP status codes that should not have an entity body
- STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 304)
+ STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 205 << 304)
SYMBOL_TO_STATUS_CODE = Hash[*HTTP_STATUS_CODES.map { |code, message|
[message.downcase.gsub(/\s|-/, '_').to_sym, code]
View
2  test/spec_chunked.rb
@@ -49,7 +49,7 @@
body.join.should.equal 'Hello World!'
end
- [100, 204, 304].each do |status_code|
+ [100, 204, 205, 304].each do |status_code|
should "not modify response when status code is #{status_code}" do
app = lambda { |env| [status_code, {}, []] }
status, headers, _ = Rack::Chunked.new(app).call(@env)
View
4 test/spec_lint.rb
@@ -241,7 +241,7 @@ def result.name
}.should.raise(Rack::Lint::LintError).
message.should.match(/No Content-Type/)
- [100, 101, 204, 304].each do |status|
+ [100, 101, 204, 205, 304].each do |status|
lambda {
Rack::Lint.new(lambda { |env|
[status, {"Content-type" => "text/plain", "Content-length" => "0"}, []]
@@ -252,7 +252,7 @@ def result.name
end
should "notice content-length errors" do
- [100, 101, 204, 304].each do |status|
+ [100, 101, 204, 205, 304].each do |status|
lambda {
Rack::Lint.new(lambda { |env|
[status, {"Content-length" => "0"}, []]
Please sign in to comment.
Something went wrong with that request. Please try again.