From 7e8e2123214e9099571e14cff03c0640ce1587ef Mon Sep 17 00:00:00 2001 From: Tim Carey-Smith Date: Sun, 1 Sep 2013 23:55:11 +1200 Subject: [PATCH] Use valid JSON for error responses --- lib/travis/api/app.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 2fc29a40..d2ee1420 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -32,6 +32,8 @@ module Travis::Api Rack.autoload :SSL, 'rack/ssl' + ERROR_RESPONSE = JSON.generate(error: 'Travis encountered an error, sorry :(') + # Used to track if setup already ran. def self.setup? @setup ||= false @@ -113,7 +115,7 @@ module Travis::Api app.call(env) rescue if Endpoint.production? - [500, {'Content-Type' => 'application/json'}, ["{'error': 'Travis encountered an error, sorry :('}"]] + [500, {'Content-Type' => 'application/json'}, [ERROR_RESPONSE]] else raise end