Set json content type only when content type is not set

This commit is contained in:
Piotr Sarnacki 2013-07-16 19:30:16 +02:00
parent b529f61675
commit c194f25a24

View File

@ -14,7 +14,7 @@ class Travis::Api::App
# TODO hmmm?
before { flash.clear }
before { content_type :json }
after { content_type :json unless content_type }
error(ActiveRecord::RecordNotFound, Sinatra::NotFound) { not_found }
not_found { content_type =~ /json/ ? { 'file' => 'not found' } : 'file not found' }