{"action":"created","comment":{"url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/comments/107765755","pull_request_review_id":28757824,"id":107765755,"diff_hunk":"@@ -367,18 +361,17 @@ export default class KintoClientBase {\n       // from within a batch operation.\n       const msg = \"This result is generated from within a batch \" +\n         \"operation and should not be consumed.\";\n-      return Promise.resolve(raw ? { json: msg, headers: { get() {} } } : msg);\n+      return raw ? { json: msg, headers: { get() {} } } : msg;\n     }\n-    const promise = this.fetchServerSettings().then(_ => {\n-      return this.http.request(this.remote + request.path, {\n-        ...request,\n-        body: stringify ? JSON.stringify(request.body) : request.body,\n-      });\n+    await this.fetchServerSettings();","path":"src/base.js","position":176,"original_position":176,"commit_id":"5def5ee9724d8a1e6b14a81103485d7ead6800eb","original_commit_id":"b03cea072f8f53a6ceeb9d7dd714e8bededf0a6e","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars2.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"`execute` is used by every other method performing an HTTP query to the server, and I didn't want to call that function in each of them (especially as many are decorated with the `@capable` decorator, which needs server capabilities from the settings). This is basically a way to initialize the client with server settings once and for all (the `fetchServerSettings` memoizes the settings the first time it knows about them). \r\n\r\nHow would you do it? Also, it sounds like we should comment this part of the code a little better.","created_at":"2017-03-23T19:42:57Z","updated_at":"2017-03-23T19:42:57Z","html_url":"https://github.com/Kinto/kinto-http.js/pull/174#discussion_r107765755","pull_request_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174","_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/comments/107765755"},"html":{"href":"https://github.com/Kinto/kinto-http.js/pull/174#discussion_r107765755"},"pull_request":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174","id":112048441,"html_url":"https://github.com/Kinto/kinto-http.js/pull/174","diff_url":"https://github.com/Kinto/kinto-http.js/pull/174.diff","patch_url":"https://github.com/Kinto/kinto-http.js/pull/174.patch","issue_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/174","number":174,"state":"closed","locked":false,"title":"Async await","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars2.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"Migrate our current async source code to use [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).\r\n\r\nNotes:\r\n \r\n- The http.js module preliminary refactoring has been isolated in a [single commit](https://github.com/Kinto/kinto-http.js/pull/174/commits/23f376e8e367e82566dcdbd8a0dd1508ef373e97) to ease the review process.\r\n- The diff is slightly larger mostly because of that large http.js module refactoring.","created_at":"2017-03-22T16:09:15Z","updated_at":"2017-03-23T19:42:57Z","closed_at":"2017-03-22T22:10:39Z","merged_at":"2017-03-22T22:10:39Z","merge_commit_sha":"2ba3a71c94d76342c3d497a1bcef7a90fb166e84","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174/commits","review_comments_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174/comments","review_comment_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/174/comments","statuses_url":"https://api.github.com/repos/Kinto/kinto-http.js/statuses/5def5ee9724d8a1e6b14a81103485d7ead6800eb","head":{"label":"Kinto:async-await","ref":"async-await","sha":"5def5ee9724d8a1e6b14a81103485d7ead6800eb","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars1.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":51152385,"name":"kinto-http.js","full_name":"Kinto/kinto-http.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars1.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto-http.js","description":"A JavaScript HTTP client for the Kinto API.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto-http.js","forks_url":"https://api.github.com/repos/Kinto/kinto-http.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto-http.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto-http.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto-http.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto-http.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto-http.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto-http.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto-http.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto-http.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto-http.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto-http.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto-http.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto-http.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto-http.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto-http.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto-http.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto-http.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto-http.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto-http.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto-http.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto-http.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto-http.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto-http.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto-http.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto-http.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto-http.js/releases{/id}","deployments_url":"https://api.github.com/repos/Kinto/kinto-http.js/deployments","created_at":"2016-02-05T14:49:10Z","updated_at":"2017-03-06T22:52:38Z","pushed_at":"2017-03-23T15:46:33Z","git_url":"git://github.com/Kinto/kinto-http.js.git","ssh_url":"git@github.com:Kinto/kinto-http.js.git","clone_url":"https://github.com/Kinto/kinto-http.js.git","svn_url":"https://github.com/Kinto/kinto-http.js","homepage":"https://doc.esdoc.org/github.com/Kinto/kinto-http.js/","size":517,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":14,"forks":10,"open_issues":14,"watchers":18,"default_branch":"master"}},"base":{"label":"Kinto:master","ref":"master","sha":"974479d36aa12905edecd72618e827325e66407e","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars1.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":51152385,"name":"kinto-http.js","full_name":"Kinto/kinto-http.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars1.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto-http.js","description":"A JavaScript HTTP client for the Kinto API.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto-http.js","forks_url":"https://api.github.com/repos/Kinto/kinto-http.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto-http.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto-http.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto-http.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto-http.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto-http.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto-http.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto-http.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto-http.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto-http.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto-http.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto-http.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto-http.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto-http.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto-http.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto-http.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto-http.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto-http.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto-http.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto-http.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto-http.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto-http.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto-http.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto-http.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto-http.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto-http.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto-http.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto-http.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto-http.js/releases{/id}","deployments_url":"https://api.github.com/repos/Kinto/kinto-http.js/deployments","created_at":"2016-02-05T14:49:10Z","updated_at":"2017-03-06T22:52:38Z","pushed_at":"2017-03-23T15:46:33Z","git_url":"git://github.com/Kinto/kinto-http.js.git","ssh_url":"git@github.com:Kinto/kinto-http.js.git","clone_url":"https://github.com/Kinto/kinto-http.js.git","svn_url":"https://github.com/Kinto/kinto-http.js","homepage":"https://doc.esdoc.org/github.com/Kinto/kinto-http.js/","size":517,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":14,"forks":10,"open_issues":14,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174"},"html":{"href":"https://github.com/Kinto/kinto-http.js/pull/174"},"issue":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/issues/174"},"comments":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/Kinto/kinto-http.js/statuses/5def5ee9724d8a1e6b14a81103485d7ead6800eb"}}}}
{"actor":{"display_login":"n1k0"}}