Sha256: 32297498ae4a6a2d50a301e70a05143e5b8307cd7944a61efd37899625b0a183
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
module Rasti module Web class Request < Rack::Request def params @params ||= Hash::Indifferent.new.tap do |hash| hash.update self.GET hash.update self.POST hash.update env[ROUTE_PARAMS] if env.key? ROUTE_PARAMS hash.update JSON.parse(body_text) if json? && body_text end end def body_text @body_text ||= begin text = body.read body.rewind text end end def json? !content_type.nil? && ContentType.parse(content_type).mime_type == 'application/json' rescue false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rasti-web-2.0.1 | lib/rasti/web/request.rb |