{"action":"created","comment":{"url":"https://api.github.com/repos/php-http/plugins/pulls/comments/48639784","id":48639784,"diff_hunk":"@@ -0,0 +1,72 @@\n+<?php\n+\n+namespace Http\\Client\\Plugin;\n+\n+use Http\\Promise\\Promise;\n+use Psr\\Http\\Message\\RequestInterface;\n+use Psr\\Http\\Message\\UriInterface;\n+\n+class BaseUriPlugin implements Plugin\n+{\n+    /**\n+     * @var UriInterface\n+     */\n+    private $baseUri;\n+\n+    /**\n+     * @param UriInterface $baseUri\n+     */\n+    public function __construct(UriInterface $baseUri)\n+    {\n+        $this->baseUri = $baseUri;\n+    }\n+\n+    /**\n+     * Handle the request and return the response coming from the next callable.\n+     *\n+     * @param RequestInterface $request\n+     * @param callable         $next    Next middleware in the chain, the request is passed as the first argument\n+     * @param callable         $first   First middleware in the chain, used to to restart a request\n+     *\n+     * @return Promise\n+     */\n+    public function handleRequest(RequestInterface $request, callable $next, callable $first)\n+    {\n+        $uriString = $request->getUri()->__toString();\n+        if (!strpos($uriString, '://')) {","path":"src/BaseUriPlugin.php","position":36,"original_position":36,"commit_id":"fde01d39a20b1b469dc5970fa8b698f035b8fd51","original_commit_id":"fde01d39a20b1b469dc5970fa8b698f035b8fd51","user":{"login":"joelwurtz","id":90466,"avatar_url":"https://avatars.githubusercontent.com/u/90466?v=3","gravatar_id":"","url":"https://api.github.com/users/joelwurtz","html_url":"https://github.com/joelwurtz","followers_url":"https://api.github.com/users/joelwurtz/followers","following_url":"https://api.github.com/users/joelwurtz/following{/other_user}","gists_url":"https://api.github.com/users/joelwurtz/gists{/gist_id}","starred_url":"https://api.github.com/users/joelwurtz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelwurtz/subscriptions","organizations_url":"https://api.github.com/users/joelwurtz/orgs","repos_url":"https://api.github.com/users/joelwurtz/repos","events_url":"https://api.github.com/users/joelwurtz/events{/privacy}","received_events_url":"https://api.github.com/users/joelwurtz/received_events","type":"User","site_admin":false},"body":"Hum nevermind my comment didn't read well, instead it's not possible to change the host with the base uri ?","created_at":"2015-12-30T23:42:11Z","updated_at":"2015-12-30T23:42:11Z","html_url":"https://github.com/php-http/plugins/pull/42#discussion_r48639784","pull_request_url":"https://api.github.com/repos/php-http/plugins/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/php-http/plugins/pulls/comments/48639784"},"html":{"href":"https://github.com/php-http/plugins/pull/42#discussion_r48639784"},"pull_request":{"href":"https://api.github.com/repos/php-http/plugins/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/php-http/plugins/pulls/42","id":54767550,"html_url":"https://github.com/php-http/plugins/pull/42","diff_url":"https://github.com/php-http/plugins/pull/42.diff","patch_url":"https://github.com/php-http/plugins/pull/42.patch","issue_url":"https://api.github.com/repos/php-http/plugins/issues/42","number":42,"state":"open","locked":false,"title":"Added BaseUriPlugin","user":{"login":"Nyholm","id":1275206,"avatar_url":"https://avatars.githubusercontent.com/u/1275206?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyholm","html_url":"https://github.com/Nyholm","followers_url":"https://api.github.com/users/Nyholm/followers","following_url":"https://api.github.com/users/Nyholm/following{/other_user}","gists_url":"https://api.github.com/users/Nyholm/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyholm/subscriptions","organizations_url":"https://api.github.com/users/Nyholm/orgs","repos_url":"https://api.github.com/users/Nyholm/repos","events_url":"https://api.github.com/users/Nyholm/events{/privacy}","received_events_url":"https://api.github.com/users/Nyholm/received_events","type":"User","site_admin":false},"body":"This will implement baseUri functionality. It copies Guzzle's behaviour when the input starts with a slash. \r\n\t\r\n// base uri  is http://foo.com/api/\r\n\r\n| Input | Output |\r\n| ----- | ------ |\r\n| http://baz.com/biz | http://baz.com/biz \r\n| foo | http://foo.com/api/foo\r\n| /foo | http://foo.com/foo\r\n\r\n","created_at":"2015-12-29T23:40:41Z","updated_at":"2015-12-30T23:42:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"782eecf159d6456289924fb8c481a91436a8a8f4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/php-http/plugins/pulls/42/commits","review_comments_url":"https://api.github.com/repos/php-http/plugins/pulls/42/comments","review_comment_url":"https://api.github.com/repos/php-http/plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/php-http/plugins/issues/42/comments","statuses_url":"https://api.github.com/repos/php-http/plugins/statuses/fde01d39a20b1b469dc5970fa8b698f035b8fd51","head":{"label":"Nyholm:base","ref":"base","sha":"fde01d39a20b1b469dc5970fa8b698f035b8fd51","user":{"login":"Nyholm","id":1275206,"avatar_url":"https://avatars.githubusercontent.com/u/1275206?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyholm","html_url":"https://github.com/Nyholm","followers_url":"https://api.github.com/users/Nyholm/followers","following_url":"https://api.github.com/users/Nyholm/following{/other_user}","gists_url":"https://api.github.com/users/Nyholm/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyholm/subscriptions","organizations_url":"https://api.github.com/users/Nyholm/orgs","repos_url":"https://api.github.com/users/Nyholm/repos","events_url":"https://api.github.com/users/Nyholm/events{/privacy}","received_events_url":"https://api.github.com/users/Nyholm/received_events","type":"User","site_admin":false},"repo":{"id":46977267,"name":"plugins","full_name":"Nyholm/plugins","owner":{"login":"Nyholm","id":1275206,"avatar_url":"https://avatars.githubusercontent.com/u/1275206?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyholm","html_url":"https://github.com/Nyholm","followers_url":"https://api.github.com/users/Nyholm/followers","following_url":"https://api.github.com/users/Nyholm/following{/other_user}","gists_url":"https://api.github.com/users/Nyholm/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyholm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyholm/subscriptions","organizations_url":"https://api.github.com/users/Nyholm/orgs","repos_url":"https://api.github.com/users/Nyholm/repos","events_url":"https://api.github.com/users/Nyholm/events{/privacy}","received_events_url":"https://api.github.com/users/Nyholm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nyholm/plugins","description":"Plugin client, decorate http client with middlewares","fork":true,"url":"https://api.github.com/repos/Nyholm/plugins","forks_url":"https://api.github.com/repos/Nyholm/plugins/forks","keys_url":"https://api.github.com/repos/Nyholm/plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nyholm/plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nyholm/plugins/teams","hooks_url":"https://api.github.com/repos/Nyholm/plugins/hooks","issue_events_url":"https://api.github.com/repos/Nyholm/plugins/issues/events{/number}","events_url":"https://api.github.com/repos/Nyholm/plugins/events","assignees_url":"https://api.github.com/repos/Nyholm/plugins/assignees{/user}","branches_url":"https://api.github.com/repos/Nyholm/plugins/branches{/branch}","tags_url":"https://api.github.com/repos/Nyholm/plugins/tags","blobs_url":"https://api.github.com/repos/Nyholm/plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nyholm/plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nyholm/plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nyholm/plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nyholm/plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/Nyholm/plugins/languages","stargazers_url":"https://api.github.com/repos/Nyholm/plugins/stargazers","contributors_url":"https://api.github.com/repos/Nyholm/plugins/contributors","subscribers_url":"https://api.github.com/repos/Nyholm/plugins/subscribers","subscription_url":"https://api.github.com/repos/Nyholm/plugins/subscription","commits_url":"https://api.github.com/repos/Nyholm/plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nyholm/plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nyholm/plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nyholm/plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nyholm/plugins/contents/{+path}","compare_url":"https://api.github.com/repos/Nyholm/plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nyholm/plugins/merges","archive_url":"https://api.github.com/repos/Nyholm/plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nyholm/plugins/downloads","issues_url":"https://api.github.com/repos/Nyholm/plugins/issues{/number}","pulls_url":"https://api.github.com/repos/Nyholm/plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/Nyholm/plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/Nyholm/plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nyholm/plugins/labels{/name}","releases_url":"https://api.github.com/repos/Nyholm/plugins/releases{/id}","created_at":"2015-11-27T11:40:56Z","updated_at":"2015-11-27T11:40:57Z","pushed_at":"2015-12-30T18:21:44Z","git_url":"git://github.com/Nyholm/plugins.git","ssh_url":"git@github.com:Nyholm/plugins.git","clone_url":"https://github.com/Nyholm/plugins.git","svn_url":"https://github.com/Nyholm/plugins","homepage":"http://httplug.io","size":88,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"php-http:master","ref":"master","sha":"15ea05ef427a898d750598d309d6ec1ec72e2572","user":{"login":"php-http","id":12104859,"avatar_url":"https://avatars.githubusercontent.com/u/12104859?v=3","gravatar_id":"","url":"https://api.github.com/users/php-http","html_url":"https://github.com/php-http","followers_url":"https://api.github.com/users/php-http/followers","following_url":"https://api.github.com/users/php-http/following{/other_user}","gists_url":"https://api.github.com/users/php-http/gists{/gist_id}","starred_url":"https://api.github.com/users/php-http/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-http/subscriptions","organizations_url":"https://api.github.com/users/php-http/orgs","repos_url":"https://api.github.com/users/php-http/repos","events_url":"https://api.github.com/users/php-http/events{/privacy}","received_events_url":"https://api.github.com/users/php-http/received_events","type":"Organization","site_admin":false},"repo":{"id":45717095,"name":"plugins","full_name":"php-http/plugins","owner":{"login":"php-http","id":12104859,"avatar_url":"https://avatars.githubusercontent.com/u/12104859?v=3","gravatar_id":"","url":"https://api.github.com/users/php-http","html_url":"https://github.com/php-http","followers_url":"https://api.github.com/users/php-http/followers","following_url":"https://api.github.com/users/php-http/following{/other_user}","gists_url":"https://api.github.com/users/php-http/gists{/gist_id}","starred_url":"https://api.github.com/users/php-http/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-http/subscriptions","organizations_url":"https://api.github.com/users/php-http/orgs","repos_url":"https://api.github.com/users/php-http/repos","events_url":"https://api.github.com/users/php-http/events{/privacy}","received_events_url":"https://api.github.com/users/php-http/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/php-http/plugins","description":"Plugin client, decorate HTTP client with middlewares","fork":false,"url":"https://api.github.com/repos/php-http/plugins","forks_url":"https://api.github.com/repos/php-http/plugins/forks","keys_url":"https://api.github.com/repos/php-http/plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/php-http/plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/php-http/plugins/teams","hooks_url":"https://api.github.com/repos/php-http/plugins/hooks","issue_events_url":"https://api.github.com/repos/php-http/plugins/issues/events{/number}","events_url":"https://api.github.com/repos/php-http/plugins/events","assignees_url":"https://api.github.com/repos/php-http/plugins/assignees{/user}","branches_url":"https://api.github.com/repos/php-http/plugins/branches{/branch}","tags_url":"https://api.github.com/repos/php-http/plugins/tags","blobs_url":"https://api.github.com/repos/php-http/plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/php-http/plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/php-http/plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/php-http/plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/php-http/plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/php-http/plugins/languages","stargazers_url":"https://api.github.com/repos/php-http/plugins/stargazers","contributors_url":"https://api.github.com/repos/php-http/plugins/contributors","subscribers_url":"https://api.github.com/repos/php-http/plugins/subscribers","subscription_url":"https://api.github.com/repos/php-http/plugins/subscription","commits_url":"https://api.github.com/repos/php-http/plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/php-http/plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/php-http/plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/php-http/plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/php-http/plugins/contents/{+path}","compare_url":"https://api.github.com/repos/php-http/plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/php-http/plugins/merges","archive_url":"https://api.github.com/repos/php-http/plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/php-http/plugins/downloads","issues_url":"https://api.github.com/repos/php-http/plugins/issues{/number}","pulls_url":"https://api.github.com/repos/php-http/plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/php-http/plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/php-http/plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/php-http/plugins/labels{/name}","releases_url":"https://api.github.com/repos/php-http/plugins/releases{/id}","created_at":"2015-11-07T01:13:49Z","updated_at":"2015-12-27T10:23:11Z","pushed_at":"2015-12-30T18:21:44Z","git_url":"git://github.com/php-http/plugins.git","ssh_url":"git@github.com:php-http/plugins.git","clone_url":"https://github.com/php-http/plugins.git","svn_url":"https://github.com/php-http/plugins","homepage":"http://httplug.io","size":102,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/php-http/plugins/pulls/42"},"html":{"href":"https://github.com/php-http/plugins/pull/42"},"issue":{"href":"https://api.github.com/repos/php-http/plugins/issues/42"},"comments":{"href":"https://api.github.com/repos/php-http/plugins/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/php-http/plugins/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/php-http/plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/php-http/plugins/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/php-http/plugins/statuses/fde01d39a20b1b469dc5970fa8b698f035b8fd51"}}}}