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:
@@ -1,7 +1,7 @@
|
||||
module IqdbTestHelper
|
||||
def mock_iqdb_matches(matches)
|
||||
Danbooru.config.stubs(:iqdb_url).returns("http://localhost:5588")
|
||||
response = HTTP::Response.new(status: 200, body: matches.to_json, headers: { "Content-Type": "application/json" }, version: "1.1")
|
||||
response = HTTP::Response.new(status: 200, body: matches.to_json, headers: { "Content-Type": "application/json" }, version: "1.1", request: nil)
|
||||
HTTP::Client.any_instance.stubs(:post).returns(response)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module ReportbooruHelper
|
||||
def mock_request(url, method: :get, status: 200, body: nil, http: Danbooru::Http.any_instance, **options)
|
||||
response = HTTP::Response.new(status: status, body: body, version: "1.1")
|
||||
response = HTTP::Response.new(status: status, body: body, version: "1.1", request: nil)
|
||||
http.stubs(method).with(url, **options).returns(response)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user