lib/optic/middleware.rb in optic-middleware-0.1.2 vs lib/optic/middleware.rb in optic-middleware-0.1.3
- old
+ new
@@ -3,10 +3,11 @@
module Optic
class DocumentingMiddleware
def initialize(app, options = {})
@app = app
+ @app.freeze
end
def call(env)
req = Rack::Request.new(env)
res = @app.call(env)
@@ -38,10 +39,10 @@
logging_request = Net::HTTP.const_get(req.request_method.capitalize).new(req.fullpath)
# Include Headers
addHeaders(headerHash(req.env), logging_request)
# Include body
- if logging_request.request_body_permitted? && req.body
+ if req.body
logging_request.body_stream = req.body
logging_request.content_length = req.content_length.to_i
logging_request.content_type = req.content_type if req.content_type
logging_request.body_stream.rewind
end