{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/11245","labels_url":"https://api.github.com/repos/angular/angular.js/issues/11245/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/11245/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/11245/events","html_url":"https://github.com/angular/angular.js/issues/11245","id":59882102,"number":11245,"title":"Add promise support to respond method of $httpBackend.when(...) calls","user":{"login":"ChrisPearce","id":402894,"avatar_url":"https://avatars.githubusercontent.com/u/402894?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisPearce","html_url":"https://github.com/ChrisPearce","followers_url":"https://api.github.com/users/ChrisPearce/followers","following_url":"https://api.github.com/users/ChrisPearce/following{/other_user}","gists_url":"https://api.github.com/users/ChrisPearce/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisPearce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisPearce/subscriptions","organizations_url":"https://api.github.com/users/ChrisPearce/orgs","repos_url":"https://api.github.com/users/ChrisPearce/repos","events_url":"https://api.github.com/users/ChrisPearce/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisPearce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-04T23:47:44Z","updated_at":"2015-04-06T11:57:44Z","closed_at":null,"body":"It would be useful for the \"respond\" method of the httpBackend.when(...) calls to support promises.\r\n\r\nCurrently the respond method accepts either:\r\n* a set of static data to be returned; or\r\n* a function that can return an array containing response status (number), response data (string), response headers (Object), and the text for the status (string).\r\n\r\nThe limitation occurs when wanting to use $httpBackend for backend-less development of applications that use the $http service, with scenarios where the \"fake\" data can only be returned by asynchronous operations (e.g. calls to indexeddb).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/90028691","html_url":"https://github.com/angular/angular.js/issues/11245#issuecomment-90028691","issue_url":"https://api.github.com/repos/angular/angular.js/issues/11245","id":90028691,"user":{"login":"carlos-algms","id":4634613,"avatar_url":"https://avatars.githubusercontent.com/u/4634613?v=3","gravatar_id":"","url":"https://api.github.com/users/carlos-algms","html_url":"https://github.com/carlos-algms","followers_url":"https://api.github.com/users/carlos-algms/followers","following_url":"https://api.github.com/users/carlos-algms/following{/other_user}","gists_url":"https://api.github.com/users/carlos-algms/gists{/gist_id}","starred_url":"https://api.github.com/users/carlos-algms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlos-algms/subscriptions","organizations_url":"https://api.github.com/users/carlos-algms/orgs","repos_url":"https://api.github.com/users/carlos-algms/repos","events_url":"https://api.github.com/users/carlos-algms/events{/privacy}","received_events_url":"https://api.github.com/users/carlos-algms/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T11:57:44Z","updated_at":"2015-04-06T11:57:44Z","body":"I think that could be the problem.  I'm not using it only on unity tests,\nI'm using it as a complete replacement of a backend.\nAn async support, will help on show loading modals and test timeouts.\n\n2015-04-02 17:49 GMT-03:00 Pawel Kozlowski <notifications@github.com>:\n\n> But the whole point of this mock is to be fast & synchronous... Opening up\n> ability to specify async / long running operations would promote the exact\n> opposite practice that we want to promote.... Such tests would be fragile\n> and no longer unit-tests really...\n>\n> @carlos-algms <https://github.com/carlos-algms> I'm not sure you want to\n> simulate \"overloaded\" server in a unit test, really... Could you share a\n> test you are trying to write? You can already simulate different order of\n> responses and IMO this is the only thing that should matter for your test...\n>\n> Anyway, we need to understand the practical, real-life problem better\n> here, as we don't want to promote async / slow unit tests...\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/angular/angular.js/issues/11245#issuecomment-89041064>\n> .\n>\n"}}