Class: Faraday::Request::XML

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/request/xml.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ XML

Returns a new instance of XML.



6
7
8
9
# File 'lib/faraday/request/xml.rb', line 6

def initialize(app, options={})
  @app     = app
  @options = options
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/faraday/request/xml.rb', line 11

def call(env)
  if env[:method] == :post
    env[:body] = env[:body].to_xml(:root => env[:body].delete(:root))
  end

  @app.call(env)
end