body json request not working
faustoct1 opened this issue · comments
Does not support body json request after upgrading to 0.14.2. Event with the code below it's not working
app.rb
use Rack::Parser, :content_types => {
'application/json' => Proc.new { |body| ::MultiJson.decode(body) }
}
controller.rb
hash = params[:val]
hash is nil
@DAddYE any ideia?? Related issue here flori/json#356
@DAddYE , Rack::Parser
is not working
use Rack::Parser, :content_types => {
'application/json' => Proc.new { |body| ::MultiJson.decode body }
}
fixed it adding to my class will be executed before any request
before do
params.keys.each { |key|
params[key.to_sym] = JSON.parse(params[key], :symbolize_names => true)
params[key] = JSON.parse(params[key])
}
end