{"action":"created","comment":{"url":"https://api.github.com/repos/reem/iron-test/pulls/comments/48329177","id":48329177,"diff_hunk":"@@ -0,0 +1,250 @@\n+/// Contains convenience methods for making requests to Iron Handlers.\n+use hyper::buffer::BufReader;\n+use hyper::http::h1::HttpReader;\n+use hyper::net::NetworkStream;\n+\n+use iron::prelude::*;\n+use iron::request::Body;\n+use iron::{Handler, headers, Headers, method, TypeMap, Url};\n+\n+use std::io::Cursor;\n+\n+use super::mock_stream::MockStream;\n+\n+/// Convenience method for making GET requests to Iron Handlers.\n+pub fn get<H: Handler>(path: &str, headers: Headers, handler: H) -> IronResult<Response> {\n+    make_request(method::Get, path, \"\", headers, handler)\n+}\n+\n+/// Convenience method for making POST requests with a body to Iron Handlers.\n+pub fn post<H: Handler>(path: &str, headers: Headers, body: &str, handler: H) -> IronResult<Response> {\n+    make_request(method::Post, path, body, headers, handler)\n+}\n+\n+/// Convenience method for making PATCH requests with a body to Iron Handlers.\n+pub fn patch<H: Handler>(path: &str, headers: Headers, body: &str, handler: H) -> IronResult<Response> {\n+    make_request(method::Patch, path, body, headers, handler)\n+}\n+\n+/// Convenience method for making PUT requests with a body to Iron Handlers.\n+pub fn put<H: Handler>(path: &str, headers: Headers, body: &str, handler: H) -> IronResult<Response> {\n+    make_request(method::Put, path, body, headers, handler)\n+}\n+\n+/// Convenience method for making DELETE requests to Iron Handlers.\n+pub fn delete<H: Handler>(path: &str, headers: Headers, handler: H) -> IronResult<Response> {\n+    make_request(method::Delete, path, \"\", headers, handler)\n+}\n+\n+/// Convenience method for making OPTIONS requests to Iron Handlers.\n+pub fn options<H: Handler>(path: &str, headers: Headers, handler: H) -> IronResult<Response> {\n+    make_request(method::Options, path, \"\", headers, handler)\n+}\n+\n+/// Convenience method for making HEAD requests to Iron Handlers.\n+pub fn head<H: Handler>(path: &str, headers: Headers, handler: H) -> IronResult<Response> {\n+    make_request(method::Head, path, \"\", headers, handler)\n+}\n+\n+fn make_request<H: Handler>(method: method::Method,","path":"src/request.rs","position":49,"original_position":49,"commit_id":"a4050b248e9df6263c4dc2986ce76edfdc7e1433","original_commit_id":"a4050b248e9df6263c4dc2986ce76edfdc7e1433","user":{"login":"reem","id":4745181,"avatar_url":"https://avatars.githubusercontent.com/u/4745181?v=3","gravatar_id":"","url":"https://api.github.com/users/reem","html_url":"https://github.com/reem","followers_url":"https://api.github.com/users/reem/followers","following_url":"https://api.github.com/users/reem/following{/other_user}","gists_url":"https://api.github.com/users/reem/gists{/gist_id}","starred_url":"https://api.github.com/users/reem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reem/subscriptions","organizations_url":"https://api.github.com/users/reem/orgs","repos_url":"https://api.github.com/users/reem/repos","events_url":"https://api.github.com/users/reem/events{/privacy}","received_events_url":"https://api.github.com/users/reem/received_events","type":"User","site_admin":false},"body":"I meant literally mark this function pub and change its name to `request`, that shouldn't break anything.","created_at":"2015-12-23T08:42:36Z","updated_at":"2015-12-23T08:42:36Z","html_url":"https://github.com/reem/iron-test/pull/24#discussion_r48329177","pull_request_url":"https://api.github.com/repos/reem/iron-test/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/reem/iron-test/pulls/comments/48329177"},"html":{"href":"https://github.com/reem/iron-test/pull/24#discussion_r48329177"},"pull_request":{"href":"https://api.github.com/repos/reem/iron-test/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/reem/iron-test/pulls/24","id":53799679,"html_url":"https://github.com/reem/iron-test/pull/24","diff_url":"https://github.com/reem/iron-test/pull/24.diff","patch_url":"https://github.com/reem/iron-test/pull/24.patch","issue_url":"https://api.github.com/repos/reem/iron-test/issues/24","number":24,"state":"open","locked":false,"title":"Response helpers","user":{"login":"mcasper","id":6878025,"avatar_url":"https://avatars.githubusercontent.com/u/6878025?v=3","gravatar_id":"","url":"https://api.github.com/users/mcasper","html_url":"https://github.com/mcasper","followers_url":"https://api.github.com/users/mcasper/followers","following_url":"https://api.github.com/users/mcasper/following{/other_user}","gists_url":"https://api.github.com/users/mcasper/gists{/gist_id}","starred_url":"https://api.github.com/users/mcasper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcasper/subscriptions","organizations_url":"https://api.github.com/users/mcasper/orgs","repos_url":"https://api.github.com/users/mcasper/repos","events_url":"https://api.github.com/users/mcasper/events{/privacy}","received_events_url":"https://api.github.com/users/mcasper/received_events","type":"User","site_admin":false},"body":"Restructures the code into smaller bits and flattens the hierarchy.\r\n```\r\nsrc\r\n├── lib.rs\r\n├── mock_stream.rs\r\n├── project_builder.rs\r\n├── request.rs\r\n└── response.rs\r\n```\r\n\r\nAlso introduces the `response` mod, which right now just has two simple helper methods, `extract_body_to_bytes` and `extract_body_to_string`.\r\n\r\nBranched off of #23","created_at":"2015-12-16T05:04:10Z","updated_at":"2015-12-23T08:42:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a93eab58fedbc50eb1532262c54d04c9c04c2dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reem/iron-test/pulls/24/commits","review_comments_url":"https://api.github.com/repos/reem/iron-test/pulls/24/comments","review_comment_url":"https://api.github.com/repos/reem/iron-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reem/iron-test/issues/24/comments","statuses_url":"https://api.github.com/repos/reem/iron-test/statuses/a4050b248e9df6263c4dc2986ce76edfdc7e1433","head":{"label":"mcasper:response_helpers","ref":"response_helpers","sha":"a4050b248e9df6263c4dc2986ce76edfdc7e1433","user":{"login":"mcasper","id":6878025,"avatar_url":"https://avatars.githubusercontent.com/u/6878025?v=3","gravatar_id":"","url":"https://api.github.com/users/mcasper","html_url":"https://github.com/mcasper","followers_url":"https://api.github.com/users/mcasper/followers","following_url":"https://api.github.com/users/mcasper/following{/other_user}","gists_url":"https://api.github.com/users/mcasper/gists{/gist_id}","starred_url":"https://api.github.com/users/mcasper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcasper/subscriptions","organizations_url":"https://api.github.com/users/mcasper/orgs","repos_url":"https://api.github.com/users/mcasper/repos","events_url":"https://api.github.com/users/mcasper/events{/privacy}","received_events_url":"https://api.github.com/users/mcasper/received_events","type":"User","site_admin":false},"repo":{"id":46938171,"name":"iron-test","full_name":"mcasper/iron-test","owner":{"login":"mcasper","id":6878025,"avatar_url":"https://avatars.githubusercontent.com/u/6878025?v=3","gravatar_id":"","url":"https://api.github.com/users/mcasper","html_url":"https://github.com/mcasper","followers_url":"https://api.github.com/users/mcasper/followers","following_url":"https://api.github.com/users/mcasper/following{/other_user}","gists_url":"https://api.github.com/users/mcasper/gists{/gist_id}","starred_url":"https://api.github.com/users/mcasper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcasper/subscriptions","organizations_url":"https://api.github.com/users/mcasper/orgs","repos_url":"https://api.github.com/users/mcasper/repos","events_url":"https://api.github.com/users/mcasper/events{/privacy}","received_events_url":"https://api.github.com/users/mcasper/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcasper/iron-test","description":"Utilities for testing Iron and Iron Middleware","fork":true,"url":"https://api.github.com/repos/mcasper/iron-test","forks_url":"https://api.github.com/repos/mcasper/iron-test/forks","keys_url":"https://api.github.com/repos/mcasper/iron-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcasper/iron-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcasper/iron-test/teams","hooks_url":"https://api.github.com/repos/mcasper/iron-test/hooks","issue_events_url":"https://api.github.com/repos/mcasper/iron-test/issues/events{/number}","events_url":"https://api.github.com/repos/mcasper/iron-test/events","assignees_url":"https://api.github.com/repos/mcasper/iron-test/assignees{/user}","branches_url":"https://api.github.com/repos/mcasper/iron-test/branches{/branch}","tags_url":"https://api.github.com/repos/mcasper/iron-test/tags","blobs_url":"https://api.github.com/repos/mcasper/iron-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcasper/iron-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcasper/iron-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcasper/iron-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcasper/iron-test/statuses/{sha}","languages_url":"https://api.github.com/repos/mcasper/iron-test/languages","stargazers_url":"https://api.github.com/repos/mcasper/iron-test/stargazers","contributors_url":"https://api.github.com/repos/mcasper/iron-test/contributors","subscribers_url":"https://api.github.com/repos/mcasper/iron-test/subscribers","subscription_url":"https://api.github.com/repos/mcasper/iron-test/subscription","commits_url":"https://api.github.com/repos/mcasper/iron-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcasper/iron-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcasper/iron-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcasper/iron-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcasper/iron-test/contents/{+path}","compare_url":"https://api.github.com/repos/mcasper/iron-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcasper/iron-test/merges","archive_url":"https://api.github.com/repos/mcasper/iron-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcasper/iron-test/downloads","issues_url":"https://api.github.com/repos/mcasper/iron-test/issues{/number}","pulls_url":"https://api.github.com/repos/mcasper/iron-test/pulls{/number}","milestones_url":"https://api.github.com/repos/mcasper/iron-test/milestones{/number}","notifications_url":"https://api.github.com/repos/mcasper/iron-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcasper/iron-test/labels{/name}","releases_url":"https://api.github.com/repos/mcasper/iron-test/releases{/id}","created_at":"2015-11-26T16:54:24Z","updated_at":"2015-11-26T16:54:24Z","pushed_at":"2015-12-16T05:00:47Z","git_url":"git://github.com/mcasper/iron-test.git","ssh_url":"git@github.com:mcasper/iron-test.git","clone_url":"https://github.com/mcasper/iron-test.git","svn_url":"https://github.com/mcasper/iron-test","homepage":"","size":49,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"reem:master","ref":"master","sha":"3d2478c3ed64bd7364ce88292882a9b7f8ff0df6","user":{"login":"reem","id":4745181,"avatar_url":"https://avatars.githubusercontent.com/u/4745181?v=3","gravatar_id":"","url":"https://api.github.com/users/reem","html_url":"https://github.com/reem","followers_url":"https://api.github.com/users/reem/followers","following_url":"https://api.github.com/users/reem/following{/other_user}","gists_url":"https://api.github.com/users/reem/gists{/gist_id}","starred_url":"https://api.github.com/users/reem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reem/subscriptions","organizations_url":"https://api.github.com/users/reem/orgs","repos_url":"https://api.github.com/users/reem/repos","events_url":"https://api.github.com/users/reem/events{/privacy}","received_events_url":"https://api.github.com/users/reem/received_events","type":"User","site_admin":false},"repo":{"id":22776170,"name":"iron-test","full_name":"reem/iron-test","owner":{"login":"reem","id":4745181,"avatar_url":"https://avatars.githubusercontent.com/u/4745181?v=3","gravatar_id":"","url":"https://api.github.com/users/reem","html_url":"https://github.com/reem","followers_url":"https://api.github.com/users/reem/followers","following_url":"https://api.github.com/users/reem/following{/other_user}","gists_url":"https://api.github.com/users/reem/gists{/gist_id}","starred_url":"https://api.github.com/users/reem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reem/subscriptions","organizations_url":"https://api.github.com/users/reem/orgs","repos_url":"https://api.github.com/users/reem/repos","events_url":"https://api.github.com/users/reem/events{/privacy}","received_events_url":"https://api.github.com/users/reem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reem/iron-test","description":"Utilities for testing Iron and Iron Middleware","fork":false,"url":"https://api.github.com/repos/reem/iron-test","forks_url":"https://api.github.com/repos/reem/iron-test/forks","keys_url":"https://api.github.com/repos/reem/iron-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reem/iron-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reem/iron-test/teams","hooks_url":"https://api.github.com/repos/reem/iron-test/hooks","issue_events_url":"https://api.github.com/repos/reem/iron-test/issues/events{/number}","events_url":"https://api.github.com/repos/reem/iron-test/events","assignees_url":"https://api.github.com/repos/reem/iron-test/assignees{/user}","branches_url":"https://api.github.com/repos/reem/iron-test/branches{/branch}","tags_url":"https://api.github.com/repos/reem/iron-test/tags","blobs_url":"https://api.github.com/repos/reem/iron-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reem/iron-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reem/iron-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/reem/iron-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reem/iron-test/statuses/{sha}","languages_url":"https://api.github.com/repos/reem/iron-test/languages","stargazers_url":"https://api.github.com/repos/reem/iron-test/stargazers","contributors_url":"https://api.github.com/repos/reem/iron-test/contributors","subscribers_url":"https://api.github.com/repos/reem/iron-test/subscribers","subscription_url":"https://api.github.com/repos/reem/iron-test/subscription","commits_url":"https://api.github.com/repos/reem/iron-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/reem/iron-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/reem/iron-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/reem/iron-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/reem/iron-test/contents/{+path}","compare_url":"https://api.github.com/repos/reem/iron-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reem/iron-test/merges","archive_url":"https://api.github.com/repos/reem/iron-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reem/iron-test/downloads","issues_url":"https://api.github.com/repos/reem/iron-test/issues{/number}","pulls_url":"https://api.github.com/repos/reem/iron-test/pulls{/number}","milestones_url":"https://api.github.com/repos/reem/iron-test/milestones{/number}","notifications_url":"https://api.github.com/repos/reem/iron-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reem/iron-test/labels{/name}","releases_url":"https://api.github.com/repos/reem/iron-test/releases{/id}","created_at":"2014-08-09T01:31:31Z","updated_at":"2015-12-14T01:03:47Z","pushed_at":"2015-12-16T05:04:10Z","git_url":"git://github.com/reem/iron-test.git","ssh_url":"git@github.com:reem/iron-test.git","clone_url":"https://github.com/reem/iron-test.git","svn_url":"https://github.com/reem/iron-test","homepage":"","size":44,"stargazers_count":10,"watchers_count":10,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":2,"forks":20,"open_issues":2,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reem/iron-test/pulls/24"},"html":{"href":"https://github.com/reem/iron-test/pull/24"},"issue":{"href":"https://api.github.com/repos/reem/iron-test/issues/24"},"comments":{"href":"https://api.github.com/repos/reem/iron-test/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/reem/iron-test/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/reem/iron-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reem/iron-test/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/reem/iron-test/statuses/a4050b248e9df6263c4dc2986ce76edfdc7e1433"}}}}