Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created May 29, 2017 20:15
Show Gist options
  • Save washingtonsoares/582a64f86b0b44ca8f028b9b3698d93d to your computer and use it in GitHub Desktop.
Save washingtonsoares/582a64f86b0b44ca8f028b9b3698d93d to your computer and use it in GitHub Desktop.
var httpBackendMock = function() {
angular.module('httpBackendMock', ['defina-se-backoffice-ui'])
.factory('loginInterceptor', function() {
return {
request: function(config) {
if(config.url.includes('get-authenticated-user')) {
config.url = config.url + '?role=student'
console.log(config)
}
return config;
},
response: function(config) {
console.log(config)
return config;
}
}
})
.config(function($httpProvider){
$httpProvider.interceptors.push('loginInterceptor')
})
}
browser.addMockModule('httpBackendMock', httpBackendMock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment