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.
8 lines
345 B
Ruby
8 lines
345 B
Ruby
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", request: nil)
|
|
HTTP::Client.any_instance.stubs(:post).returns(response)
|
|
end
|
|
end
|