Sha256: 7093ee14cde5560d1ef65e00906ce2f6572ba52b6b91231e6590bf4e820d86fb

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

module Ethon
  class Easy
    module Http

      # This module contains logic for setting up a [multipart] POST body.
      module Postable

        # Set things up when form is provided.
        # Deals with multipart forms.
        #
        # @example Setup.
        #   post.set_form(easy)
        #
        # @param [ Easy ] easy The easy to setup.
        def set_form(easy)
          easy.url ||= url
          form.params_encoding = params_encoding
          if form.multipart?
            form.escape = false
            form.materialize
            easy.httppost = form.first.read_pointer
          else
            form.escape = true
            easy.postfieldsize = form.to_s.bytesize
            easy.copypostfields = form.to_s
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ethon-0.8.0/lib/ethon/easy/http/postable.rb
ethon-0.8.0 lib/ethon/easy/http/postable.rb
ethon-0.7.4 lib/ethon/easy/http/postable.rb