(function() {
	'use strict';
	
	angular.module('Core')
		.service('httpRequestService', httpRequestService);

		httpRequestService.$inject = ['$http', 'commonService'];
		function httpRequestService($http, commonService) {
			var service = this;
			service.http = http;

			/* ======================================== Var ==================================================== */
			service.misc = {
	        	
	        };
	        service.baseUrl = '';
			var apiObj = {
	        	/*  Example:
	        	
	        		name: {
						methodType: 'POST' / 'GET' / 'PUT' / 'DELETE',
						url: '...',
						nextUrlPart: '...'		<= This refers to eg: http://www.google.com/:id/nextUrlPart
	        		}
	        	 */
	        }

	        /* ======================================== Services =============================================== */
	        var cmnSvc = commonService;

	        /* ======================================== Public Methods ========================================= */
	        // Take note to check the way your auth token is being passed in the header (if its in the header at all)
	        function http(apiObjKey, headerObj, dataObj, authToken, idOnUrl) {
	            var deferred = cmnSvc.$q.defer();

	            var headerObject = cmnSvc.isObjPresent(headerObj) ? headerObj : {};
	            var dataObj = cmnSvc.isObjPresent(dataObj) ? dataObj : {};

	            if (authToken === true) {
	                headerObject['Authorization'] = 'Token token=' + sessionSvc.userData.access_token
	            }

	            if(cmnSvc.isObjPresent(idOnUrl)) {
	                idOnUrl = '/' + idOnUrl;
	            } else {
	                idOnUrl = '';
	            }

	            var nextUrl = '';
	            if (cmnSvc.isObjPresent(apiObj[apiObjKey].nextUrlPart)) {
	                nextUrl = '/' + apiObj[apiObjKey].nextUrlPart;
	            }

	            if (cmnSvc.isObjPresent(dataObj) && (cmnSvc.isObjPresent(dataObj.image_url))) {
	                dataObj.image_url = dataObj.image_url.$ngfDataUrl.substring(dataObj.image_url.$ngfDataUrl.indexOf(',') + 1);
	            }

	            // If HTTP GET request, API params to be set to "params" key in $http request object
	            // If HTTP POST/PUT request, API params to be set to "data" key in $http request object
	            if (apiObj[apiObjKey].methodType.toLowerCase() == 'get' || apiObj[apiObjKey].methodType.toLowerCase() == 'delete') {
	                $http({
	                    method: apiObj[apiObjKey].methodType,
	                    url: service.baseUrl + apiObj[apiObjKey].url + idOnUrl + nextUrl,
	                    headers: headerObject,
	                    params: dataObj
	                }).then(function(rs) {
	                    if(cmnSvc.isObjPresent(rs.data.status)) {
	                        if (rs.data.status.toLowerCase() === 'ok') {
	                            deferred.resolve(rs.data);
	                        } else {
	                            deferred.reject(rs.data);
	                        }
	                    } else {
	                        deferred.reject(rs.data);
	                    }
	                }, function(err) { // This should never be called as all reponses will be a 200
	                    console.log('Non processed error by server. ' + err.data); // To be removed for prod
	                });
	            } else {
	                $http({
	                    method: apiObj[apiObjKey].methodType,
	                    url: service.baseUrl + apiObj[apiObjKey].url + idOnUrl + nextUrl,
	                    headers: headerObject,
	                    data: dataObj
	                }).then(function(rs) {
	                    if(cmnSvc.isObjPresent(rs.data.status)) {
	                        if (rs.data.status.toLowerCase() === 'ok') {
	                            deferred.resolve(rs.data);
	                        } else {
	                            deferred.reject(rs.data);
	                        }
	                    } else {
	                        deferred.reject(rs.data);
	                    }
	                }, function(err) { // This should never be called as all reponses will be a 200
	                    console.log('Non processed error by server. ' + err.data); // To be removed for prod
	                });
	            }

	            return deferred.promise;
	        }

	        /* ======================================== Private Methods ======================================== */

		}
})();
@@ -1320,16 +1320,19 @@
  dataObj
+ect
  = cmnSv
@@ -1911,16 +1911,19 @@
 (dataObj
+ect
 ) && (cm
@@ -1939,32 +1939,35 @@
 jPresent(dataObj
+ect
 .image_url))) %7B%0A
@@ -1982,32 +1982,35 @@
          dataObj
+ect
 .image_url = dat
@@ -2009,24 +2009,27 @@
 rl = dataObj
+ect
 .image_url.$
@@ -2056,16 +2056,19 @@
 (dataObj
+ect
 .image_u
@@ -2144,16 +2144,23 @@
 HTTP GET
+/DELETE
  request
@@ -2696,32 +2696,35 @@
  params: dataObj
+ect
 %0A%09              
@@ -2769,153 +2769,9 @@
     
-    if(cmnSvc.isObjPresent(rs.data.status)) %7B%0A%09                        if (rs.data.status.toLowerCase() === 'ok') %7B%0A%09                            
+%09
 defe
@@ -2777,37 +2777,32 @@
 erred.resolve(rs
-.data
 );%0A%09            
@@ -2809,142 +2809,28 @@
     
- 
-       %7D else %7B%0A%09                            deferred.reject(rs.data);%0A%09                        %7D%0A%09                    %7D else %7B%0A%09    
+%7D, function(err) %7B%0A%09
     
@@ -2862,246 +2862,15 @@
 reje
-c
 t(
-rs.data);%0A%09                    %7D%0A%09                %7D, function(err) %7B // This should never be called as all reponses will be a 200%0A%09                    console.log('Non processed error by server. ' + err.data); // To be removed for prod
+err);
 %0A%09  
@@ -3158,16 +3158,19 @@
  dataObj
+ect
 %0A%09      
@@ -3227,149 +3227,8 @@
     
-if(cmnSvc.isObjPresent(rs.data.status)) %7B%0A%09                        if (rs.data.status.toLowerCase() === 'ok') %7B%0A%09                            
 defe
@@ -3242,21 +3242,16 @@
 solve(rs
-.data
 );%0A%09    
@@ -3266,413 +3266,69 @@
     
-        %7D else %7B%0A%09                            deferred.reject(rs.data);%0A%09                        %7D%0A%09                    %7D else %7B%0A%09                        deferred.reject(rs.data);%0A%09                    %7D%0A%09                %7D, function(err) %7B // This should never be called as all reponses will be a 200%0A%09                    console.log('Non processed error by server. ' + err.data); // To be removed for prod
+%7D, function(err) %7B%0A%09                    deferred.reject(err);
 %0A%09  

Fix some bugs in http method