Sha256: 8a84a56ce2c2324930ab2f3ffc7ab6dd4bfba2a2023b78ce6e834149d7cd419b

Contents?: true

Size: 656 Bytes

Versions: 8

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "http/form_data"

module HTTPX::Transcoder
  module Form
    module_function

    class Encoder
      extend Forwardable

      def_delegator :@raw, :content_type

      def_delegator :@raw, :to_s

      def_delegator :@raw, :read

      def initialize(form)
        @raw = HTTP::FormData.create(form)
      end

      def bytesize
        @raw.content_length
      end

      def force_encoding(*args)
        @raw.to_s.force_encoding(*args)
      end

      def to_str
        @raw.to_s
      end
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
httpx-0.2.1 lib/httpx/transcoder/form.rb
httpx-0.2.0 lib/httpx/transcoder/form.rb
httpx-0.1.0 lib/httpx/transcoder/form.rb
httpx-0.0.5 lib/httpx/transcoder/form.rb
httpx-0.0.4 lib/httpx/transcoder/form.rb
httpx-0.0.3 lib/httpx/transcoder/form.rb
httpx-0.0.2 lib/httpx/transcoder/form.rb
httpx-0.0.1 lib/httpx/transcoder/form.rb