Class: Alice::Request::Yajl

Inherits:
Middleware show all
Defined in:
lib/alice/request/yajl.rb

Instance Method Summary collapse

Methods inherited from Middleware

#create_form_params, #full_path_for, #initialize, loaded?, #process_body_for_request, setup_parallel_manager

Constructor Details

This class inherits a constructor from Alice::Middleware

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/alice/request/yajl.rb', line 10

def call(env)
  env[:request_headers]['Content-Type'] = 'application/json'
  if env[:body] && !env[:body].respond_to?(:to_str)
    env[:body] = Yajl::Encoder.encode env[:body]
  end
  @app.call env
end