Module: HTTPX::Plugins::XML::Transcoder

Defined in:
lib/httpx/plugins/xml.rb

Defined Under Namespace

Classes: Encoder

Class Method Summary collapse

Class Method Details

.decode(response) ⇒ Object

Raises:

[View source]

38
39
40
41
42
43
44
# File 'lib/httpx/plugins/xml.rb', line 38

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

  raise HTTPX::Error, "invalid form mime type (#{content_type})" unless MIME_TYPES.match?(content_type)

  Nokogiri::XML.method(:parse)
end

.encode(xml) ⇒ Object

[View source]

34
35
36
# File 'lib/httpx/plugins/xml.rb', line 34

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