From 537f0ceef093d00845949638e67d2c723c499bed Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 16 Sep 2015 23:45:01 -0700 Subject: [PATCH] Log all http requests at start and end // FREEBIE --- js/libtextsecure.js | 4 ++++ libtextsecure/api.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index e6af11900..c173f5c21 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38931,6 +38931,7 @@ TextSecureServer = function () { */ function ajax(url, options) { return new Promise(function (resolve, reject) { + console.log(options.type, url); var error = new Error(); // just in case, save stack here. var xhr = new XMLHttpRequest(); xhr.open(options.type, url, true /*async*/); @@ -38955,12 +38956,15 @@ TextSecureServer = function () { try { result = JSON.parse(xhr.responseText + ''); } catch(e) {} } if ( 0 <= xhr.status && xhr.status < 400) { + console.log('Success', xhr.status); resolve(result, xhr.status); } else { + console.log('Error', xhr.status); reject(HTTPError(xhr.status, result, error.stack)); } }; xhr.onerror = function() { + console.log('Error', xhr.status); reject(HTTPError(xhr.status, null, error.stack)); }; xhr.send( options.data || null ); diff --git a/libtextsecure/api.js b/libtextsecure/api.js index 647d00529..f541b1c52 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -42,6 +42,7 @@ TextSecureServer = function () { */ function ajax(url, options) { return new Promise(function (resolve, reject) { + console.log(options.type, url); var error = new Error(); // just in case, save stack here. var xhr = new XMLHttpRequest(); xhr.open(options.type, url, true /*async*/); @@ -66,12 +67,15 @@ TextSecureServer = function () { try { result = JSON.parse(xhr.responseText + ''); } catch(e) {} } if ( 0 <= xhr.status && xhr.status < 400) { + console.log('Success', xhr.status); resolve(result, xhr.status); } else { + console.log('Error', xhr.status); reject(HTTPError(xhr.status, result, error.stack)); } }; xhr.onerror = function() { + console.log('Error', xhr.status); reject(HTTPError(xhr.status, null, error.stack)); }; xhr.send( options.data || null );