{"action":"created","comment":{"url":"https://api.github.com/repos/aurelia/http-client/pulls/comments/30999839","id":30999839,"diff_hunk":"@@ -93,13 +110,36 @@ export class HttpClient {\n       transformers[i](this, processor, message);\n     }\n \n-    promise = processor.process(this, message).then(response => {\n-      trackRequestEnd(this, processor);\n-      return response;\n-    }).catch(response => {\n-      trackRequestEnd(this, processor);\n-      throw response;\n-    });\n+    processRequest = (message) => {","path":"src/http-client.js","position":48,"original_position":48,"commit_id":"8ed4176276e604c2334bc4b2d3471ecb8ebfda0f","original_commit_id":"8ed4176276e604c2334bc4b2d3471ecb8ebfda0f","user":{"login":"bryanrsmith","id":186704,"avatar_url":"https://avatars.githubusercontent.com/u/186704?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanrsmith","html_url":"https://github.com/bryanrsmith","followers_url":"https://api.github.com/users/bryanrsmith/followers","following_url":"https://api.github.com/users/bryanrsmith/following{/other_user}","gists_url":"https://api.github.com/users/bryanrsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanrsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanrsmith/subscriptions","organizations_url":"https://api.github.com/users/bryanrsmith/orgs","repos_url":"https://api.github.com/users/bryanrsmith/repos","events_url":"https://api.github.com/users/bryanrsmith/events{/privacy}","received_events_url":"https://api.github.com/users/bryanrsmith/received_events","type":"User","site_admin":false},"body":"I think the problem we're going to run into here is that all transformers run inside the processor. Most of the client's API uses transformers to set request properties, so the message that the `request` and `requestError` handlers see will pretty much always be an empty message.\r\n\r\nWhat do you think about breaking up the `processor.process` method so that the message is fully constructed by one method and then sent by another? That would let us apply the transformers & everything to build the complete message, then run the request interceptors, then send the message. I think it would make interceptors a lot more useful since they'd be able to inspect and modify the message with the data that will be sent. It would also let the `requestError` interceptors catch any errors caused by transformers.","created_at":"2015-05-26T01:28:02Z","updated_at":"2015-05-26T01:28:02Z","html_url":"https://github.com/aurelia/http-client/pull/50#discussion_r30999839","pull_request_url":"https://api.github.com/repos/aurelia/http-client/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/comments/30999839"},"html":{"href":"https://github.com/aurelia/http-client/pull/50#discussion_r30999839"},"pull_request":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/aurelia/http-client/pulls/50","id":36154670,"html_url":"https://github.com/aurelia/http-client/pull/50","diff_url":"https://github.com/aurelia/http-client/pull/50.diff","patch_url":"https://github.com/aurelia/http-client/pull/50.patch","issue_url":"https://api.github.com/repos/aurelia/http-client/issues/50","number":50,"state":"open","locked":false,"title":"feat(interceptors): added support for interceptors","user":{"login":"Mordred","id":29232,"avatar_url":"https://avatars.githubusercontent.com/u/29232?v=3","gravatar_id":"","url":"https://api.github.com/users/Mordred","html_url":"https://github.com/Mordred","followers_url":"https://api.github.com/users/Mordred/followers","following_url":"https://api.github.com/users/Mordred/following{/other_user}","gists_url":"https://api.github.com/users/Mordred/gists{/gist_id}","starred_url":"https://api.github.com/users/Mordred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mordred/subscriptions","organizations_url":"https://api.github.com/users/Mordred/orgs","repos_url":"https://api.github.com/users/Mordred/repos","events_url":"https://api.github.com/users/Mordred/events{/privacy}","received_events_url":"https://api.github.com/users/Mordred/received_events","type":"User","site_admin":false},"body":"Added support for interceptors. Interceptor can intercept four states:\r\n - `request` - when the message is constructed, but before it is sent\r\n - `requestError` - when there is an error during message building\r\n - `response` - when the response has returned\r\n - `responseError` - when the response wasn't successful\r\n\r\nfixes: #46\r\n\r\nNOTE: I had to temporary disable 3 tests (see https://github.com/jasmine/jasmine-ajax/issues/111)\r\n\r\nTake a look and tell me what you think.","created_at":"2015-05-25T19:27:57Z","updated_at":"2015-05-26T01:28:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5600bfccb1122ea7f819fbe0c371910a5e4dd10e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aurelia/http-client/pulls/50/commits","review_comments_url":"https://api.github.com/repos/aurelia/http-client/pulls/50/comments","review_comment_url":"https://api.github.com/repos/aurelia/http-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aurelia/http-client/issues/50/comments","statuses_url":"https://api.github.com/repos/aurelia/http-client/statuses/8ed4176276e604c2334bc4b2d3471ecb8ebfda0f","head":{"label":"Mordred:feature/interceptors","ref":"feature/interceptors","sha":"8ed4176276e604c2334bc4b2d3471ecb8ebfda0f","user":{"login":"Mordred","id":29232,"avatar_url":"https://avatars.githubusercontent.com/u/29232?v=3","gravatar_id":"","url":"https://api.github.com/users/Mordred","html_url":"https://github.com/Mordred","followers_url":"https://api.github.com/users/Mordred/followers","following_url":"https://api.github.com/users/Mordred/following{/other_user}","gists_url":"https://api.github.com/users/Mordred/gists{/gist_id}","starred_url":"https://api.github.com/users/Mordred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mordred/subscriptions","organizations_url":"https://api.github.com/users/Mordred/orgs","repos_url":"https://api.github.com/users/Mordred/repos","events_url":"https://api.github.com/users/Mordred/events{/privacy}","received_events_url":"https://api.github.com/users/Mordred/received_events","type":"User","site_admin":false},"repo":{"id":36037235,"name":"http-client","full_name":"Mordred/http-client","owner":{"login":"Mordred","id":29232,"avatar_url":"https://avatars.githubusercontent.com/u/29232?v=3","gravatar_id":"","url":"https://api.github.com/users/Mordred","html_url":"https://github.com/Mordred","followers_url":"https://api.github.com/users/Mordred/followers","following_url":"https://api.github.com/users/Mordred/following{/other_user}","gists_url":"https://api.github.com/users/Mordred/gists{/gist_id}","starred_url":"https://api.github.com/users/Mordred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mordred/subscriptions","organizations_url":"https://api.github.com/users/Mordred/orgs","repos_url":"https://api.github.com/users/Mordred/repos","events_url":"https://api.github.com/users/Mordred/events{/privacy}","received_events_url":"https://api.github.com/users/Mordred/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mordred/http-client","description":"A simple, restful, message-based wrapper around XMLHttpRequest.","fork":true,"url":"https://api.github.com/repos/Mordred/http-client","forks_url":"https://api.github.com/repos/Mordred/http-client/forks","keys_url":"https://api.github.com/repos/Mordred/http-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mordred/http-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mordred/http-client/teams","hooks_url":"https://api.github.com/repos/Mordred/http-client/hooks","issue_events_url":"https://api.github.com/repos/Mordred/http-client/issues/events{/number}","events_url":"https://api.github.com/repos/Mordred/http-client/events","assignees_url":"https://api.github.com/repos/Mordred/http-client/assignees{/user}","branches_url":"https://api.github.com/repos/Mordred/http-client/branches{/branch}","tags_url":"https://api.github.com/repos/Mordred/http-client/tags","blobs_url":"https://api.github.com/repos/Mordred/http-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mordred/http-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mordred/http-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mordred/http-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mordred/http-client/statuses/{sha}","languages_url":"https://api.github.com/repos/Mordred/http-client/languages","stargazers_url":"https://api.github.com/repos/Mordred/http-client/stargazers","contributors_url":"https://api.github.com/repos/Mordred/http-client/contributors","subscribers_url":"https://api.github.com/repos/Mordred/http-client/subscribers","subscription_url":"https://api.github.com/repos/Mordred/http-client/subscription","commits_url":"https://api.github.com/repos/Mordred/http-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mordred/http-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mordred/http-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mordred/http-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mordred/http-client/contents/{+path}","compare_url":"https://api.github.com/repos/Mordred/http-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mordred/http-client/merges","archive_url":"https://api.github.com/repos/Mordred/http-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mordred/http-client/downloads","issues_url":"https://api.github.com/repos/Mordred/http-client/issues{/number}","pulls_url":"https://api.github.com/repos/Mordred/http-client/pulls{/number}","milestones_url":"https://api.github.com/repos/Mordred/http-client/milestones{/number}","notifications_url":"https://api.github.com/repos/Mordred/http-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mordred/http-client/labels{/name}","releases_url":"https://api.github.com/repos/Mordred/http-client/releases{/id}","created_at":"2015-05-21T21:02:23Z","updated_at":"2015-05-21T21:02:24Z","pushed_at":"2015-05-25T08:14:45Z","git_url":"git://github.com/Mordred/http-client.git","ssh_url":"git@github.com:Mordred/http-client.git","clone_url":"https://github.com/Mordred/http-client.git","svn_url":"https://github.com/Mordred/http-client","homepage":null,"size":812,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aurelia:master","ref":"master","sha":"fc98ecc5fcb00c16140b1524ba0a5ba16bb702e7","user":{"login":"aurelia","id":9808864,"avatar_url":"https://avatars.githubusercontent.com/u/9808864?v=3","gravatar_id":"","url":"https://api.github.com/users/aurelia","html_url":"https://github.com/aurelia","followers_url":"https://api.github.com/users/aurelia/followers","following_url":"https://api.github.com/users/aurelia/following{/other_user}","gists_url":"https://api.github.com/users/aurelia/gists{/gist_id}","starred_url":"https://api.github.com/users/aurelia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aurelia/subscriptions","organizations_url":"https://api.github.com/users/aurelia/orgs","repos_url":"https://api.github.com/users/aurelia/repos","events_url":"https://api.github.com/users/aurelia/events{/privacy}","received_events_url":"https://api.github.com/users/aurelia/received_events","type":"Organization","site_admin":false},"repo":{"id":27786488,"name":"http-client","full_name":"aurelia/http-client","owner":{"login":"aurelia","id":9808864,"avatar_url":"https://avatars.githubusercontent.com/u/9808864?v=3","gravatar_id":"","url":"https://api.github.com/users/aurelia","html_url":"https://github.com/aurelia","followers_url":"https://api.github.com/users/aurelia/followers","following_url":"https://api.github.com/users/aurelia/following{/other_user}","gists_url":"https://api.github.com/users/aurelia/gists{/gist_id}","starred_url":"https://api.github.com/users/aurelia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aurelia/subscriptions","organizations_url":"https://api.github.com/users/aurelia/orgs","repos_url":"https://api.github.com/users/aurelia/repos","events_url":"https://api.github.com/users/aurelia/events{/privacy}","received_events_url":"https://api.github.com/users/aurelia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aurelia/http-client","description":"A simple, restful, message-based wrapper around XMLHttpRequest.","fork":false,"url":"https://api.github.com/repos/aurelia/http-client","forks_url":"https://api.github.com/repos/aurelia/http-client/forks","keys_url":"https://api.github.com/repos/aurelia/http-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aurelia/http-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aurelia/http-client/teams","hooks_url":"https://api.github.com/repos/aurelia/http-client/hooks","issue_events_url":"https://api.github.com/repos/aurelia/http-client/issues/events{/number}","events_url":"https://api.github.com/repos/aurelia/http-client/events","assignees_url":"https://api.github.com/repos/aurelia/http-client/assignees{/user}","branches_url":"https://api.github.com/repos/aurelia/http-client/branches{/branch}","tags_url":"https://api.github.com/repos/aurelia/http-client/tags","blobs_url":"https://api.github.com/repos/aurelia/http-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aurelia/http-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aurelia/http-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/aurelia/http-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aurelia/http-client/statuses/{sha}","languages_url":"https://api.github.com/repos/aurelia/http-client/languages","stargazers_url":"https://api.github.com/repos/aurelia/http-client/stargazers","contributors_url":"https://api.github.com/repos/aurelia/http-client/contributors","subscribers_url":"https://api.github.com/repos/aurelia/http-client/subscribers","subscription_url":"https://api.github.com/repos/aurelia/http-client/subscription","commits_url":"https://api.github.com/repos/aurelia/http-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/aurelia/http-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/aurelia/http-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/aurelia/http-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/aurelia/http-client/contents/{+path}","compare_url":"https://api.github.com/repos/aurelia/http-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aurelia/http-client/merges","archive_url":"https://api.github.com/repos/aurelia/http-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aurelia/http-client/downloads","issues_url":"https://api.github.com/repos/aurelia/http-client/issues{/number}","pulls_url":"https://api.github.com/repos/aurelia/http-client/pulls{/number}","milestones_url":"https://api.github.com/repos/aurelia/http-client/milestones{/number}","notifications_url":"https://api.github.com/repos/aurelia/http-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aurelia/http-client/labels{/name}","releases_url":"https://api.github.com/repos/aurelia/http-client/releases{/id}","created_at":"2014-12-09T20:51:59Z","updated_at":"2015-05-08T15:25:35Z","pushed_at":"2015-05-25T19:27:57Z","git_url":"git://github.com/aurelia/http-client.git","ssh_url":"git@github.com:aurelia/http-client.git","clone_url":"https://github.com/aurelia/http-client.git","svn_url":"https://github.com/aurelia/http-client","homepage":null,"size":812,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":5,"forks":14,"open_issues":5,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/50"},"html":{"href":"https://github.com/aurelia/http-client/pull/50"},"issue":{"href":"https://api.github.com/repos/aurelia/http-client/issues/50"},"comments":{"href":"https://api.github.com/repos/aurelia/http-client/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aurelia/http-client/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/aurelia/http-client/statuses/8ed4176276e604c2334bc4b2d3471ecb8ebfda0f"}}}}