Classes and Modules
Constants
PARAM_DEPTH_LIMIT | = | 32 |
Public Instance methods
decode(response)
[show source]
# File lib/httpx/transcoder/form.rb 56 def decode(response) 57 content_type = response.content_type.mime_type 58 59 case content_type 60 when "application/x-www-form-urlencoded" 61 Decoder 62 when "multipart/form-data" 63 Multipart::Decoder.new(response) 64 else 65 raise Error, "invalid form mime type (#{content_type})" 66 end 67 end
encode(form)
[show source]
# File lib/httpx/transcoder/form.rb 48 def encode(form) 49 if multipart?(form) 50 Multipart::Encoder.new(form) 51 else 52 Encoder.new(form) 53 end 54 end
multipart?(data)
[show source]
# File lib/httpx/transcoder/form.rb 69 def multipart?(data) 70 data.any? do |_, v| 71 Multipart::MULTIPART_VALUE_COND.call(v) || 72 (v.respond_to?(:to_ary) && v.to_ary.any?(&Multipart::MULTIPART_VALUE_COND)) || 73 (v.respond_to?(:to_hash) && v.to_hash.any? { |_, e| Multipart::MULTIPART_VALUE_COND.call(e) }) 74 end 75 end