소스 검색

HUE-4164 [editor] The ApiHelper should treat any negative status in the response as an error

Johan Ahlen 9 년 전
부모
커밋
5a67846573
2개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      desktop/core/src/desktop/static/desktop/js/apiHelper.js
  2. 4 0
      desktop/core/src/desktop/static/desktop/spec/apiHelperSpec.js

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -134,7 +134,7 @@
   ApiHelper.prototype.successResponseIsError = function (response) {
     return typeof response !== 'undefined' && (
         typeof response.traceback !== 'undefined' ||
-        response.status === -1 ||
+        (typeof response.status !== 'undefined' && response.status < 0) ||
         response.status === 500 ||
         response.code === 503 ||
         response.code === 500);

+ 4 - 0
desktop/core/src/desktop/static/desktop/spec/apiHelperSpec.js

@@ -38,6 +38,10 @@ define([
         expect(subject.successResponseIsError({ status: -1 })).toBeTruthy();
       });
 
+      it("should determine that a success response is an error response if status is -3", function () {
+        expect(subject.successResponseIsError({ status: -3 })).toBeTruthy();
+      });
+
       it("should determine that a success response is an error response if status is 500", function () {
         expect(subject.successResponseIsError({ status: 500 })).toBeTruthy();
       });