danbooru::http: support automatically following redirects.

Replace http.rb's builtin redirect following option with our own
redirect follower. This fixes an issue with http.rb losing cookies after
following a redirect.
This commit is contained in:
evazion
2020-06-21 03:57:14 -05:00
parent 71b0bc6c0f
commit 05d7355ebb
3 changed files with 57 additions and 14 deletions

View File

@@ -5,10 +5,11 @@ class NicoSeigaApiClient
attr_reader :http
# XXX temp disable following redirects.
def initialize(work_id:, type:, http: Danbooru::Http.follow(nil))
def initialize(work_id:, type:)
@work_id = work_id
@work_type = type
@http = http
@http = Danbooru::Http.new
@http.http.default_options.features.reject! { |name, _| name == :redirector }
end
def image_ids