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