Skip to content

Commit

Permalink
added xml request middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlecompte committed Aug 25, 2011
1 parent d2441f4 commit 135582f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/faraday/request/xml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Faraday
class Request
class XML < Faraday::Middleware
dependency 'active_support/all'

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

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

0 comments on commit 135582f

Please sign in to comment.