lib/hanami/middleware/body_parser.rb in hanami-router-2.0.0.beta2 vs lib/hanami/middleware/body_parser.rb in hanami-router-2.0.0.beta4
- old
+ new
@@ -35,11 +35,11 @@
extend ClassInterface
def initialize(app, parsers)
@app = app
- @parsers = build_parsers(parsers)
+ @parsers = parsers
end
def call(env)
body = env[RACK_INPUT].read
return @app.call(env) if body.empty?
@@ -53,22 +53,9 @@
@app.call(env)
end
private
-
- def build_parsers(parser_names)
- parser_names = Array(parser_names)
- return {} if parser_names.empty?
-
- parser_names.each_with_object({}) do |name, parsers|
- parser = self.class.for(name)
-
- parser.mime_types.each do |mime|
- parsers[mime] = parser
- end
- end
- end
# @api private
def _symbolize(body)
if body.is_a?(::Hash)
Router::Params.deep_symbolize(body)