Module: HTTPX::Transcoder::Form

Defined in:
lib/httpx/transcoder/form.rb

Defined Under Namespace

Modules: Decoder Classes: Encoder

Constant Summary collapse

PARAM_DEPTH_LIMIT =
32

Class Method Summary collapse

Class Method Details

.decode(response) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/httpx/transcoder/form.rb', line 54

def decode(response)
  content_type = response.content_type.mime_type

  case content_type
  when "application/x-www-form-urlencoded"
    Decoder
  when "multipart/form-data"
    Multipart::Decoder.new(response)
  else
    raise Error, "invalid form mime type (#{content_type})"
  end
end

.encode(form) ⇒ Object



50
51
52
# File 'lib/httpx/transcoder/form.rb', line 50

def encode(form)
  Encoder.new(form)
end