Do not override http timeout if caller has set it

The apiInterceptor code was blindly overriding the http
timeout. This caused issues for functions like code update
image uploads which can require more then the default 20
seconds.

During the course of investigating this defect, it was questioned
why the interceptor code was needed at all since the default
was set in the httpsRequest base. Some web searching found
https://stackoverflow.com/questions/15015416/how-to-set-a-global-http-timeout-in-angularjs
which discusses why this does not work.

Testing: Verified requested timeout used during image upload
and default used otherwise.

Resolves openbmc/openbmc#3182

Change-Id: I9b58a328cf7ef7d224b3c4704d9d40edcc2b4d80
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/app/common/services/apiInterceptor.js b/app/common/services/apiInterceptor.js
index 3e72cc6..de344cd 100644
--- a/app/common/services/apiInterceptor.js
+++ b/app/common/services/apiInterceptor.js
@@ -16,7 +16,10 @@
             return {
                 'request': function(config){
                     dataService.loading = true;
-                    config.timeout = 20000;
+                    // If caller has not defined a timeout, set to default of 20s
+                    if (config.timeout == null){
+                        config.timeout = 20000;
+                    }
                     return config;
                 },
                 'response': function(response){
diff --git a/app/index.js b/app/index.js
index b923ff9..d59fb9d 100644
--- a/app/index.js
+++ b/app/index.js
@@ -129,7 +129,6 @@
           $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|data|blob):/);
         }])
         .config(['$httpProvider', function($httpProvider){
-            $httpProvider.defaults.timeout = 20000;
             $httpProvider.interceptors.push('apiInterceptor');
         }])
         .run(['$rootScope', '$location', 'dataService', 'userModel',