From 4556fdf8e117fae95734d51cab7d9049e2d9f756 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Fri, 15 Nov 2013 09:43:07 -0500 Subject: [PATCH] Account for absence of `pretty` parameter --- lib/travis/api/app/helpers/respond_with.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/travis/api/app/helpers/respond_with.rb b/lib/travis/api/app/helpers/respond_with.rb index 66751047..0fb9c751 100644 --- a/lib/travis/api/app/helpers/respond_with.rb +++ b/lib/travis/api/app/helpers/respond_with.rb @@ -11,10 +11,10 @@ class Travis::Api::App def respond_with(resource, options = {}) result = respond(resource, options) if result && response.content_type =~ /application\/json/ - if params[:pretty].downcase == 'true' || params[:pretty].to_i > 0 - JSON.pretty_generate(result) + if !params[:pretty].nil? && (params[:pretty].downcase == 'true' || params[:pretty].to_i > 0) + result = JSON.pretty_generate(result) else - result.to_json + result = result.to_json end end halt result || 404