Rack::Response should not generate invalid content-length header.#2219
Conversation
1ff018f to
e0d6409
Compare
|
The one Sinatra test failure that is affected by this part of the code: However, the reason why this header is missing is because it is deleted by Sinatra's own code: https://github.com/sinatra/sinatra/blob/main/lib/sinatra/base.rb#L298 It was being inadvertently added back in by cc @dentarg |
e0d6409 to
2264cc4
Compare
|
I'm removing the Sinatra tests from this PR, as I think it's almost good to go. I might have a go at adding some tests for the behaviour of |
2264cc4 to
fe3c95e
Compare
fe3c95e to
5a77e22
Compare
7d98277 to
f07b73c
Compare
The class name changed in rack/rack@3936b90 We have been here before, for example with sinatra@1dfae3d This was hidden until Rack 3.1, from Samuel Williams[1]: > It was being inadvertently added back in by Response#buffered_body! > (invoked by MockResponse#initialize). In other words, it appears that > the test is wrong, or Sinatra's code is wrong, and this wrongness was > hidden by the previous implementation of MockResponse inadvertently > adding the content-length header when none existed in the response > itself. 1: rack/rack#2219 (comment)
- Generate the header when the length is zero. - Don't generate invalid content-length headers.
f07b73c to
0ae201c
Compare
|
I did a final check with Sinatra external tests: These are expected failures, and should be fixed in Sinatra. |
- Generate the header when the length is zero. - Don't generate invalid content-length headers.
The class name changed in rack/rack@3936b90 We have been here before, for example with sinatra@1dfae3d This was hidden until Rack 3.1, from Samuel Williams[1]: > It was being inadvertently added back in by Response#buffered_body! > (invoked by MockResponse#initialize). In other words, it appears that > the test is wrong, or Sinatra's code is wrong, and this wrongness was > hidden by the previous implementation of MockResponse inadvertently > adding the content-length header when none existed in the response > itself. 1: rack/rack#2219 (comment)
The class name changed in rack/rack@3936b90 We have been here before, for example with 1dfae3d This was hidden until Rack 3.1, from Samuel Williams[1]: > It was being inadvertently added back in by Response#buffered_body! > (invoked by MockResponse#initialize). In other words, it appears that > the test is wrong, or Sinatra's code is wrong, and this wrongness was > hidden by the previous implementation of MockResponse inadvertently > adding the content-length header when none existed in the response > itself. 1: rack/rack#2219 (comment)
The class name changed in rack/rack@3936b90 We have been here before, for example with sinatra@1dfae3d This was hidden until Rack 3.1, from Samuel Williams[1]: > It was being inadvertently added back in by Response#buffered_body! > (invoked by MockResponse#initialize). In other words, it appears that > the test is wrong, or Sinatra's code is wrong, and this wrongness was > hidden by the previous implementation of MockResponse inadvertently > adding the content-length header when none existed in the response > itself. 1: rack/rack#2219 (comment)
The class name changed in rack/rack@3936b90 We have been here before, for example with 1dfae3d This was hidden until Rack 3.1, from Samuel Williams[1]: > It was being inadvertently added back in by Response#buffered_body! > (invoked by MockResponse#initialize). In other words, it appears that > the test is wrong, or Sinatra's code is wrong, and this wrongness was > hidden by the previous implementation of MockResponse inadvertently > adding the content-length header when none existed in the response > itself. 1: rack/rack#2219 (comment)
I'm experimenting with potential fixes for #2218.