I just added this ticket. I'm writing a Sinatra API to be consumed by
Rails and I've run into an issue where the ActiveResource
documentation specifies that on update you should return an HTTP 204
status with no body. The problem is that Rack doesn't allow you to
set the Content-Length header of HTTP 204 responses.
The workaround seems to be to return a 200 response with a zero length
Content-Length header and body, but that's not what the docs say.
The fix is simple and laid out in the ticket, but here it is.
if !response['Conent-Length'].blank? && response['Content-Length'] !
= "0" && response.body.strip.size > 0
This brings up an issue with the HttpMock class included with
ActiveRecord. It defaults to specifying a Content-Type header of 0
for all requests that don't have a body. Assuming Rack has the HTTP
rules correct (204 shouldn't have that header), then the HttpMock
class is also broken.
I've just started cloning the repository to create a patch, but I'm
not sure how I should update the tests. Any pointers would be great.
Otherwise if someone wants to throw in the fix for me...