Sha256: 9ccab8025a4d31f99398e9eb20d574c75152322c739ff9d27b1e1e0e3bdd06cc

Contents?: true

Size: 586 Bytes

Versions: 19

Compression:

Stored size: 586 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "uri"

module HTTPX::Transcoder
  module Form
    module_function

    class Encoder
      extend Forwardable

      def_delegator :@raw, :to_s

      def_delegator :@raw, :bytesize

      def_delegator :@raw, :force_encoding

      def initialize(form)
        @raw = URI.encode_www_form(form)
      end

      def content_type
        "application/x-www-form-urlencoded"
      end

      def to_str
        @raw.to_s
      end
    end

    def encode(form)
      Encoder.new(form)
    end
  end
  register "form", Form
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
httpx-0.9.0 lib/httpx/transcoder/form.rb
httpx-0.8.2 lib/httpx/transcoder/form.rb
httpx-0.8.1 lib/httpx/transcoder/form.rb
httpx-0.8.0 lib/httpx/transcoder/form.rb
httpx-0.7.0 lib/httpx/transcoder/form.rb
httpx-0.6.7 lib/httpx/transcoder/form.rb
httpx-0.6.6 lib/httpx/transcoder/form.rb
httpx-0.6.5 lib/httpx/transcoder/form.rb
httpx-0.6.4 lib/httpx/transcoder/form.rb
httpx-0.6.3 lib/httpx/transcoder/form.rb
httpx-0.6.2 lib/httpx/transcoder/form.rb
httpx-0.6.1 lib/httpx/transcoder/form.rb
httpx-0.6.0 lib/httpx/transcoder/form.rb
httpx-0.5.1 lib/httpx/transcoder/form.rb
httpx-0.5.0 lib/httpx/transcoder/form.rb
httpx-0.4.1 lib/httpx/transcoder/form.rb
httpx-0.4.0 lib/httpx/transcoder/form.rb
httpx-0.3.1 lib/httpx/transcoder/form.rb
httpx-0.3.0 lib/httpx/transcoder/form.rb