{"action":"created","comment":{"url":"https://api.github.com/repos/henry808/network_tools/pulls/comments/27534083","id":27534083,"diff_hunk":"@@ -45,15 +53,59 @@ def echo_server():\n     server_socket.close()\n \n \n-def response_ok(body=''):\n+def resolve_uri(uri):\n+    \"\"\"Given a URI, return a body and content type.\n+\n+    If the URI is a directory, return that directory as a list as the body.\n+    If the URI a file, return the contents of the file as the body\n+    Content type is the file type.\n+    Raises type error if uri is not a string.\n+    Raises an IO error if the uri is not a file or directory.\n+    Raises an IO error if cannot find a mimetype.\n+    \"\"\"\n+    if not isinstance(uri, str):\n+        raise HTTPError404('Not found')\n+    uri = os.path.join(ROOT_DIR, uri)","path":"echo_server.py","position":51,"original_position":51,"commit_id":"e93ff9c35bbfd1cb9047b474daceff93b7520b8a","original_commit_id":"e93ff9c35bbfd1cb9047b474daceff93b7520b8a","user":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"body":"I fixed this by stripping the the leading /'s.","created_at":"2015-03-31T23:45:45Z","updated_at":"2015-03-31T23:45:45Z","html_url":"https://github.com/henry808/network_tools/pull/3#discussion_r27534083","pull_request_url":"https://api.github.com/repos/henry808/network_tools/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/comments/27534083"},"html":{"href":"https://github.com/henry808/network_tools/pull/3#discussion_r27534083"},"pull_request":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/henry808/network_tools/pulls/3","id":32270377,"html_url":"https://github.com/henry808/network_tools/pull/3","diff_url":"https://github.com/henry808/network_tools/pull/3.diff","patch_url":"https://github.com/henry808/network_tools/pull/3.patch","issue_url":"https://api.github.com/repos/henry808/network_tools/issues/3","number":3,"state":"open","locked":false,"title":"Http2","user":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-30T21:39:28Z","updated_at":"2015-03-31T23:45:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe01c46a4742aa28009dfbdf330a6be8e942f758","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/henry808/network_tools/pulls/3/commits","review_comments_url":"https://api.github.com/repos/henry808/network_tools/pulls/3/comments","review_comment_url":"https://api.github.com/repos/henry808/network_tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/henry808/network_tools/issues/3/comments","statuses_url":"https://api.github.com/repos/henry808/network_tools/statuses/e93ff9c35bbfd1cb9047b474daceff93b7520b8a","head":{"label":"henry808:http2","ref":"http2","sha":"e93ff9c35bbfd1cb9047b474daceff93b7520b8a","user":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"repo":{"id":30850488,"name":"network_tools","full_name":"henry808/network_tools","owner":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henry808/network_tools","description":"Network tools that deal sending simple messages back and forth between a 'client' socket and a 'server' socket. ","fork":false,"url":"https://api.github.com/repos/henry808/network_tools","forks_url":"https://api.github.com/repos/henry808/network_tools/forks","keys_url":"https://api.github.com/repos/henry808/network_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henry808/network_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henry808/network_tools/teams","hooks_url":"https://api.github.com/repos/henry808/network_tools/hooks","issue_events_url":"https://api.github.com/repos/henry808/network_tools/issues/events{/number}","events_url":"https://api.github.com/repos/henry808/network_tools/events","assignees_url":"https://api.github.com/repos/henry808/network_tools/assignees{/user}","branches_url":"https://api.github.com/repos/henry808/network_tools/branches{/branch}","tags_url":"https://api.github.com/repos/henry808/network_tools/tags","blobs_url":"https://api.github.com/repos/henry808/network_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henry808/network_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henry808/network_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/henry808/network_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henry808/network_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/henry808/network_tools/languages","stargazers_url":"https://api.github.com/repos/henry808/network_tools/stargazers","contributors_url":"https://api.github.com/repos/henry808/network_tools/contributors","subscribers_url":"https://api.github.com/repos/henry808/network_tools/subscribers","subscription_url":"https://api.github.com/repos/henry808/network_tools/subscription","commits_url":"https://api.github.com/repos/henry808/network_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/henry808/network_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/henry808/network_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/henry808/network_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/henry808/network_tools/contents/{+path}","compare_url":"https://api.github.com/repos/henry808/network_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henry808/network_tools/merges","archive_url":"https://api.github.com/repos/henry808/network_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henry808/network_tools/downloads","issues_url":"https://api.github.com/repos/henry808/network_tools/issues{/number}","pulls_url":"https://api.github.com/repos/henry808/network_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/henry808/network_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/henry808/network_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henry808/network_tools/labels{/name}","releases_url":"https://api.github.com/repos/henry808/network_tools/releases{/id}","created_at":"2015-02-16T02:17:42Z","updated_at":"2015-02-16T02:17:42Z","pushed_at":"2015-03-30T21:39:29Z","git_url":"git://github.com/henry808/network_tools.git","ssh_url":"git@github.com:henry808/network_tools.git","clone_url":"https://github.com/henry808/network_tools.git","svn_url":"https://github.com/henry808/network_tools","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"henry808:http1","ref":"http1","sha":"d1382cb23ba56303b13821c97cee617f64f0d938","user":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"repo":{"id":30850488,"name":"network_tools","full_name":"henry808/network_tools","owner":{"login":"henry808","id":9962045,"avatar_url":"https://avatars.githubusercontent.com/u/9962045?v=3","gravatar_id":"","url":"https://api.github.com/users/henry808","html_url":"https://github.com/henry808","followers_url":"https://api.github.com/users/henry808/followers","following_url":"https://api.github.com/users/henry808/following{/other_user}","gists_url":"https://api.github.com/users/henry808/gists{/gist_id}","starred_url":"https://api.github.com/users/henry808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henry808/subscriptions","organizations_url":"https://api.github.com/users/henry808/orgs","repos_url":"https://api.github.com/users/henry808/repos","events_url":"https://api.github.com/users/henry808/events{/privacy}","received_events_url":"https://api.github.com/users/henry808/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henry808/network_tools","description":"Network tools that deal sending simple messages back and forth between a 'client' socket and a 'server' socket. ","fork":false,"url":"https://api.github.com/repos/henry808/network_tools","forks_url":"https://api.github.com/repos/henry808/network_tools/forks","keys_url":"https://api.github.com/repos/henry808/network_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henry808/network_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henry808/network_tools/teams","hooks_url":"https://api.github.com/repos/henry808/network_tools/hooks","issue_events_url":"https://api.github.com/repos/henry808/network_tools/issues/events{/number}","events_url":"https://api.github.com/repos/henry808/network_tools/events","assignees_url":"https://api.github.com/repos/henry808/network_tools/assignees{/user}","branches_url":"https://api.github.com/repos/henry808/network_tools/branches{/branch}","tags_url":"https://api.github.com/repos/henry808/network_tools/tags","blobs_url":"https://api.github.com/repos/henry808/network_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henry808/network_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henry808/network_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/henry808/network_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henry808/network_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/henry808/network_tools/languages","stargazers_url":"https://api.github.com/repos/henry808/network_tools/stargazers","contributors_url":"https://api.github.com/repos/henry808/network_tools/contributors","subscribers_url":"https://api.github.com/repos/henry808/network_tools/subscribers","subscription_url":"https://api.github.com/repos/henry808/network_tools/subscription","commits_url":"https://api.github.com/repos/henry808/network_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/henry808/network_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/henry808/network_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/henry808/network_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/henry808/network_tools/contents/{+path}","compare_url":"https://api.github.com/repos/henry808/network_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henry808/network_tools/merges","archive_url":"https://api.github.com/repos/henry808/network_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henry808/network_tools/downloads","issues_url":"https://api.github.com/repos/henry808/network_tools/issues{/number}","pulls_url":"https://api.github.com/repos/henry808/network_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/henry808/network_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/henry808/network_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henry808/network_tools/labels{/name}","releases_url":"https://api.github.com/repos/henry808/network_tools/releases{/id}","created_at":"2015-02-16T02:17:42Z","updated_at":"2015-02-16T02:17:42Z","pushed_at":"2015-03-30T21:39:29Z","git_url":"git://github.com/henry808/network_tools.git","ssh_url":"git@github.com:henry808/network_tools.git","clone_url":"https://github.com/henry808/network_tools.git","svn_url":"https://github.com/henry808/network_tools","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/3"},"html":{"href":"https://github.com/henry808/network_tools/pull/3"},"issue":{"href":"https://api.github.com/repos/henry808/network_tools/issues/3"},"comments":{"href":"https://api.github.com/repos/henry808/network_tools/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/henry808/network_tools/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/henry808/network_tools/statuses/e93ff9c35bbfd1cb9047b474daceff93b7520b8a"}}}}