File: query.rb

package info (click to toggle)
ruby-httpx 1.7.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,816 kB
  • sloc: ruby: 12,209; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 689 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

module HTTPX
  module Plugins
    #
    # This plugin adds support for using the experimental QUERY HTTP method
    #
    # https://gitlab.com/os85/httpx/wikis/Query
    module Query
      def self.subplugins
        {
          retries: QueryRetries,
        }
      end

      module InstanceMethods
        def query(*uri, **options)
          request("QUERY", uri, **options)
        end
      end

      module QueryRetries
        module InstanceMethods
          private

          def retryable_request?(request, *)
            super || request.verb == "QUERY"
          end
        end
      end
    end

    register_plugin :query, Query
  end
end