From a9501d8a8fecb9df00949fe7c99a057922c35cc3 Mon Sep 17 00:00:00 2001 From: Stephen Fortune Date: Wed, 23 Aug 2017 11:44:42 +0100 Subject: [PATCH] Correctly specify the headers passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prior method wasn’t correct jquery way --- views/index.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/views/index.erb b/views/index.erb index 73597d6..0dd77ae 100644 --- a/views/index.erb +++ b/views/index.erb @@ -138,12 +138,14 @@ slug = $input.val() if (slug.length > 0) { $.ajax({ - url: 'https://api.heroku.com/apps/'+slug, - headers: 'application/vnd.heroku+json; version=3' + url: 'https://api.heroku.com/apps/' + slug, + headers: { + 'Accept': 'application/vnd.heroku+json; version=3' + } }) .always(function(data, textStatus) { if (data.status == 404) { - console.log(slug) + console.log(JSON.stringify(data, null, 4)) $input.parent('div').removeClass('has-danger') $input.parent('div').addClass('has-success') $input.removeClass('form-control-danger') @@ -151,7 +153,7 @@ $input.parent('div').find('.form-control-feedback').html("Your Bothan instance will be hosted at https://" + slug + ".herokuapp.com") $('#submit').attr('disabled', false) } else { - console.log(slug); + console.log(JSON.stringify(data, null, 4)) $input.parent('div').removeClass('has-success') $input.parent('div').addClass('has-danger') $input.removeClass('form-control-success')