{"action":"created","issue":{"url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/91","repository_url":"https://api.github.com/repos/atecarlos/protractor-http-mock","labels_url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/91/comments","events_url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/91/events","html_url":"https://github.com/atecarlos/protractor-http-mock/issues/91","id":151139662,"number":91,"title":"Interceptors + protractor-http-mock results in no $http call being completed","user":{"login":"shssoichiro","id":5951392,"avatar_url":"https://avatars.githubusercontent.com/u/5951392?v=3","gravatar_id":"","url":"https://api.github.com/users/shssoichiro","html_url":"https://github.com/shssoichiro","followers_url":"https://api.github.com/users/shssoichiro/followers","following_url":"https://api.github.com/users/shssoichiro/following{/other_user}","gists_url":"https://api.github.com/users/shssoichiro/gists{/gist_id}","starred_url":"https://api.github.com/users/shssoichiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shssoichiro/subscriptions","organizations_url":"https://api.github.com/users/shssoichiro/orgs","repos_url":"https://api.github.com/users/shssoichiro/repos","events_url":"https://api.github.com/users/shssoichiro/events{/privacy}","received_events_url":"https://api.github.com/users/shssoichiro/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/atecarlos/protractor-http-mock/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/atecarlos/protractor-http-mock/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-26T13:47:04Z","updated_at":"2016-06-02T00:21:22Z","closed_at":null,"body":"I have a `responseError` interceptor, and most of my tests (that don't go through any interceptors) work without issues, but my test that should return a mocked response error fails--it doesn't show any error message out of the ordinary, just the standard \"No element found using locator\" as if the test was failing. As far as I can tell, it's behaving as if no API call (mocked or real) is being made.\r\n\r\nThe interceptor code:\r\n\r\n    $httpProvider.interceptors.push(($rootScope, $q) => {\r\n      'ngInject';\r\n      return {\r\n        responseError: response => {\r\n          if (response.status >= 400) {\r\n            if (response.data.message) {\r\n              $rootScope.message = response.data.message;\r\n            } else if (response.data.errors) {\r\n              const firstError = _head(_head(_values(response.data.errors)));\r\n              $rootScope.message = {\r\n                type: 'danger',\r\n                text: firstError,\r\n              };\r\n            }\r\n          }\r\n\r\n          return $q.reject(response);\r\n        },\r\n      };\r\n    });\r\n\r\nThe test (also attempted having protractor manually wait for `#global-msg-text`, which resulted in a timeout):\r\n\r\n    it('should show validation messages', function () {\r\n      element(by.id('student-name-new')).clear();\r\n      element(by.id('student-save-new')).click();\r\n      expect(element(by.id('student-id-1')).getText()).toEqual('1');\r\n      expect(element(by.id('student-id-2')).getText()).toEqual('2');\r\n      expect(element(by.id('student-id-3')).getText()).toEqual('3');\r\n      expect(element.all(by.id('student-id-4')).count()).toEqual(0);\r\n      expect(element(by.id('student-name-1')).getText()).toEqual('Student 1');\r\n      expect(element(by.id('student-name-2')).getText()).toEqual('Student 2');\r\n      expect(element(by.id('student-name-3')).getText()).toEqual('Student 3');\r\n      expect(element(by.id('global-msg-text')).getText()).toEqual('The name field is required.');\r\n    });\r\n\r\nThe mock:\r\n\r\n    {\r\n      request: {\r\n        path: '/students',\r\n        method: 'POST',\r\n        data: {\r\n          name: '',\r\n        },\r\n      },\r\n      response: {\r\n        data: {\r\n          errors: {\r\n            name: [\r\n              'The name field is required.',\r\n            ],\r\n          },\r\n        },\r\n        status: 422,\r\n      },\r\n    },"},"comment":{"url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/comments/223163399","html_url":"https://github.com/atecarlos/protractor-http-mock/issues/91#issuecomment-223163399","issue_url":"https://api.github.com/repos/atecarlos/protractor-http-mock/issues/91","id":223163399,"user":{"login":"atecarlos","id":492581,"avatar_url":"https://avatars.githubusercontent.com/u/492581?v=3","gravatar_id":"","url":"https://api.github.com/users/atecarlos","html_url":"https://github.com/atecarlos","followers_url":"https://api.github.com/users/atecarlos/followers","following_url":"https://api.github.com/users/atecarlos/following{/other_user}","gists_url":"https://api.github.com/users/atecarlos/gists{/gist_id}","starred_url":"https://api.github.com/users/atecarlos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atecarlos/subscriptions","organizations_url":"https://api.github.com/users/atecarlos/orgs","repos_url":"https://api.github.com/users/atecarlos/repos","events_url":"https://api.github.com/users/atecarlos/events{/privacy}","received_events_url":"https://api.github.com/users/atecarlos/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T00:21:22Z","updated_at":"2016-06-02T00:21:22Z","body":"@cezarpavelski @slonya4ka I just pushed a new version 0.8.0 that adds empty default headers if none are provided. I think this may solve your issue. Please let me know how it goes."}}
{"actor":{"display_login":"atecarlos"}}