Upgrade http.rb gem to 5.0.4.

Fixes a bug where the Foundation source strategy failed because http.rb
automatically sent a `Content-Length: 0` header with all GET requests,
which caused Foundation to return a 400 Bad Request error. This behavior
was fixed in http.rb 5.x.

http.rb 5.x has a breaking change where it now includes the request object
inside the response object, which we have to handle in a few places.
This commit is contained in:
evazion
2022-02-21 17:47:06 -06:00
parent 35dca33abc
commit fbab273c81
8 changed files with 23 additions and 19 deletions

View File

@@ -206,7 +206,7 @@ module Danbooru
end
def fake_response(status)
::HTTP::Response.new(status: status, version: "1.1", body: "")
::HTTP::Response.new(status: status, version: "1.1", body: "", request: nil)
end
end
end

View File

@@ -19,6 +19,9 @@ module Danbooru
response.flush
response.body.instance_variable_set(:@connection, nil)
response.body.instance_variable_set(:@stream, nil)
response.instance_exec { @request = request.dup }
response.request.instance_exec { @uri_normalizer = nil }
response.request.body.instance_exec { @source = nil }
response
end