ytti/oxidized · error · Oxidized::OxidizedError

Unsupported HTTP method: #{method.inspect}. Only :get and :p

Error message

Unsupported HTTP method: #{method.inspect}. Only :get and :post are supported

What it means

Error "Unsupported HTTP method: #{method.inspect}. Only :get and :post are supported" thrown in ytti/oxidized.

Source

Thrown at lib/oxidized/input/http.rb:92

      elsif @username && @password && !authorization_header_present?(extra_headers)
        logger.debug "Falling back to Basic authentication"
        res = make_request(uri, ssl_verify, extra_headers.merge('Authorization' => basic_auth_header),
                           method: method, body: body)
      end

      logger.debug "Response code: #{res.code}"
      res
    end

    def make_request(uri, ssl_verify, extra_headers = {}, method: :get, body: nil)
      Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https", verify_mode: ssl_verify) do |http|
        req_class = if method == :get
                      Net::HTTP::Get
                    elsif method == :post
                      Net::HTTP::Post
                    else
                      raise Oxidized::OxidizedError, "Unsupported HTTP method: #{method.inspect}. " \
                                                     "Only :get and :post are supported"
                    end
        req = req_class.new(uri)
        @headers.merge(extra_headers).each { |header, value| req.add_field(header, value) }
        req.body = body if body

        logger.debug "Sending #{method.to_s.upcase} request with headers: #{@headers.merge(extra_headers)}"
        http.request(req)
      end
    end

    def authorization_header_present?(headers)
      headers.keys.any? { |key| key.to_s.downcase == 'authorization' }
    end

    def basic_auth_header
      "Basic " + ["#{@username}:#{@password}"].pack('m').delete("\r\n")
    end

View on GitHub (pinned to 687ed4262d)

When it happens

Trigger: Thrown at lib/oxidized/input/http.rb:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ytti/oxidized@687ed4262d (2026-08-23). Data as JSON: /api/errors/b80457dc0a0564b4. Report an issue: GitHub.