File: xml_parser.rb

package info (click to toggle)
ruby-actionpack-xml-parser 2.0.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 168 kB
  • sloc: ruby: 432; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'active_support'
require 'active_support/core_ext/hash/conversions'
require 'action_dispatch'
require 'action_dispatch/http/request'
require 'action_pack/xml_parser/version'

module ActionPack
  class XmlParser
    def self.register
      original_parsers = ActionDispatch::Request.parameter_parsers
      ActionDispatch::Request.parameter_parsers = original_parsers.merge(Mime[:xml].symbol => self)
    end

    def self.call(raw_post)
      Hash.from_xml(raw_post) || {}
    end
  end
end