Skip to content

Commit

Permalink
Monley patch HTTP.rb to handle PURGE requests
Browse files Browse the repository at this point in the history
Until httprb/http#757 is merged
  • Loading branch information
renchap committed Aug 17, 2023
1 parent bf07b71 commit d0695fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/lib/request.rb
Expand Up @@ -117,7 +117,7 @@ def add_headers(new_headers)

def perform
begin
response = http_client.public_send(@verb, @url.to_s, @options.merge(headers: headers))
response = http_client.request(@verb, @url.to_s, @options.merge(headers: headers))
rescue => e
raise e.class, "#{e.message} on #{@url}", e.backtrace[0]
end
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Expand Up @@ -51,6 +51,7 @@
require_relative '../lib/active_record/database_tasks_extensions'
require_relative '../lib/active_record/batches'
require_relative '../lib/simple_navigation/item_extensions'
require_relative '../lib/http_extensions'

Dotenv::Railtie.load

Expand Down
10 changes: 10 additions & 0 deletions lib/http_extensions.rb
@@ -0,0 +1,10 @@
# frozen_string_literal: true

# Monkey patching until https://github.com/httprb/http/pull/757 is merged
unless HTTP::Request::METHODS.include?(:purge)
module HTTP
class Request
METHODS = METHODS.dup.push(:purge).freeze
end
end
end

0 comments on commit d0695fd

Please sign in to comment.