{"action":"opened","number":79,"pull_request":{"url":"https://api.github.com/repos/glock45/swifter/pulls/79","id":53810020,"html_url":"https://github.com/glock45/swifter/pull/79","diff_url":"https://github.com/glock45/swifter/pull/79.diff","patch_url":"https://github.com/glock45/swifter/pull/79.patch","issue_url":"https://api.github.com/repos/glock45/swifter/issues/79","number":79,"state":"open","locked":false,"title":"Added support for routing based on HTTP request methods","user":{"login":"C0deH4cker","id":1310775,"avatar_url":"https://avatars.githubusercontent.com/u/1310775?v=3","gravatar_id":"","url":"https://api.github.com/users/C0deH4cker","html_url":"https://github.com/C0deH4cker","followers_url":"https://api.github.com/users/C0deH4cker/followers","following_url":"https://api.github.com/users/C0deH4cker/following{/other_user}","gists_url":"https://api.github.com/users/C0deH4cker/gists{/gist_id}","starred_url":"https://api.github.com/users/C0deH4cker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C0deH4cker/subscriptions","organizations_url":"https://api.github.com/users/C0deH4cker/orgs","repos_url":"https://api.github.com/users/C0deH4cker/repos","events_url":"https://api.github.com/users/C0deH4cker/events{/privacy}","received_events_url":"https://api.github.com/users/C0deH4cker/received_events","type":"User","site_admin":false},"body":"Now, in addition to the old method of routing, you can do the following:\r\n\r\n```\r\nserver.GET[\"/path\"] = { request in\r\n    // Handle GET request to /path\r\n}\r\n\r\nserver.POST[\"/path] = { request in\r\n    // Handle POST request to /path\r\n}\r\n\r\nserver.PUT[\"/path\"] = { request in\r\n    // Handle PUT request to /path\r\n}\r\n\r\nserver.DELETE[\"/path\"] = { request in\r\n    // Handle DELETE request to /path\r\n}\r\n\r\nserver.ANY[\"/path\"] = { request in\r\n    // Handle any of the known HTTP request types for /path\r\n}\r\n```\r\n\r\nOne other change from this pull request is that HTTP request methods other than GET, POST, PUT, or DELETE result in an error. This can be changed if necessary (or more methods could be added), though I think that it's best for the server itself to catch invalid HTTP method errors.\r\n\r\nCurrently, `server[\"/path\"]` behaves the same way as it used to (same as `server.ANY[\"/path\"]`), although I recommend changing the behavior of this to either default to GET or to outright remove the old behavior.","created_at":"2015-12-16T08:07:28Z","updated_at":"2015-12-16T08:07:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/glock45/swifter/pulls/79/commits","review_comments_url":"https://api.github.com/repos/glock45/swifter/pulls/79/comments","review_comment_url":"https://api.github.com/repos/glock45/swifter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/glock45/swifter/issues/79/comments","statuses_url":"https://api.github.com/repos/glock45/swifter/statuses/ae60b6aa434b4486a1c6815ae198e4bf105701bb","head":{"label":"C0deH4cker:master","ref":"master","sha":"ae60b6aa434b4486a1c6815ae198e4bf105701bb","user":{"login":"C0deH4cker","id":1310775,"avatar_url":"https://avatars.githubusercontent.com/u/1310775?v=3","gravatar_id":"","url":"https://api.github.com/users/C0deH4cker","html_url":"https://github.com/C0deH4cker","followers_url":"https://api.github.com/users/C0deH4cker/followers","following_url":"https://api.github.com/users/C0deH4cker/following{/other_user}","gists_url":"https://api.github.com/users/C0deH4cker/gists{/gist_id}","starred_url":"https://api.github.com/users/C0deH4cker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C0deH4cker/subscriptions","organizations_url":"https://api.github.com/users/C0deH4cker/orgs","repos_url":"https://api.github.com/users/C0deH4cker/repos","events_url":"https://api.github.com/users/C0deH4cker/events{/privacy}","received_events_url":"https://api.github.com/users/C0deH4cker/received_events","type":"User","site_admin":false},"repo":{"id":48096172,"name":"swifter","full_name":"C0deH4cker/swifter","owner":{"login":"C0deH4cker","id":1310775,"avatar_url":"https://avatars.githubusercontent.com/u/1310775?v=3","gravatar_id":"","url":"https://api.github.com/users/C0deH4cker","html_url":"https://github.com/C0deH4cker","followers_url":"https://api.github.com/users/C0deH4cker/followers","following_url":"https://api.github.com/users/C0deH4cker/following{/other_user}","gists_url":"https://api.github.com/users/C0deH4cker/gists{/gist_id}","starred_url":"https://api.github.com/users/C0deH4cker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C0deH4cker/subscriptions","organizations_url":"https://api.github.com/users/C0deH4cker/orgs","repos_url":"https://api.github.com/users/C0deH4cker/repos","events_url":"https://api.github.com/users/C0deH4cker/events{/privacy}","received_events_url":"https://api.github.com/users/C0deH4cker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/C0deH4cker/swifter","description":"Tiny http server engine written in Swift programming language.","fork":true,"url":"https://api.github.com/repos/C0deH4cker/swifter","forks_url":"https://api.github.com/repos/C0deH4cker/swifter/forks","keys_url":"https://api.github.com/repos/C0deH4cker/swifter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/C0deH4cker/swifter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/C0deH4cker/swifter/teams","hooks_url":"https://api.github.com/repos/C0deH4cker/swifter/hooks","issue_events_url":"https://api.github.com/repos/C0deH4cker/swifter/issues/events{/number}","events_url":"https://api.github.com/repos/C0deH4cker/swifter/events","assignees_url":"https://api.github.com/repos/C0deH4cker/swifter/assignees{/user}","branches_url":"https://api.github.com/repos/C0deH4cker/swifter/branches{/branch}","tags_url":"https://api.github.com/repos/C0deH4cker/swifter/tags","blobs_url":"https://api.github.com/repos/C0deH4cker/swifter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/C0deH4cker/swifter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/C0deH4cker/swifter/git/refs{/sha}","trees_url":"https://api.github.com/repos/C0deH4cker/swifter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/C0deH4cker/swifter/statuses/{sha}","languages_url":"https://api.github.com/repos/C0deH4cker/swifter/languages","stargazers_url":"https://api.github.com/repos/C0deH4cker/swifter/stargazers","contributors_url":"https://api.github.com/repos/C0deH4cker/swifter/contributors","subscribers_url":"https://api.github.com/repos/C0deH4cker/swifter/subscribers","subscription_url":"https://api.github.com/repos/C0deH4cker/swifter/subscription","commits_url":"https://api.github.com/repos/C0deH4cker/swifter/commits{/sha}","git_commits_url":"https://api.github.com/repos/C0deH4cker/swifter/git/commits{/sha}","comments_url":"https://api.github.com/repos/C0deH4cker/swifter/comments{/number}","issue_comment_url":"https://api.github.com/repos/C0deH4cker/swifter/issues/comments{/number}","contents_url":"https://api.github.com/repos/C0deH4cker/swifter/contents/{+path}","compare_url":"https://api.github.com/repos/C0deH4cker/swifter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/C0deH4cker/swifter/merges","archive_url":"https://api.github.com/repos/C0deH4cker/swifter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/C0deH4cker/swifter/downloads","issues_url":"https://api.github.com/repos/C0deH4cker/swifter/issues{/number}","pulls_url":"https://api.github.com/repos/C0deH4cker/swifter/pulls{/number}","milestones_url":"https://api.github.com/repos/C0deH4cker/swifter/milestones{/number}","notifications_url":"https://api.github.com/repos/C0deH4cker/swifter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/C0deH4cker/swifter/labels{/name}","releases_url":"https://api.github.com/repos/C0deH4cker/swifter/releases{/id}","created_at":"2015-12-16T08:01:58Z","updated_at":"2015-12-16T08:01:58Z","pushed_at":"2015-12-16T08:02:11Z","git_url":"git://github.com/C0deH4cker/swifter.git","ssh_url":"git@github.com:C0deH4cker/swifter.git","clone_url":"https://github.com/C0deH4cker/swifter.git","svn_url":"https://github.com/C0deH4cker/swifter","homepage":null,"size":6740,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":"glock45:master","ref":"master","sha":"30882a0400b20603ba3ea94b3446a71daf679c7f","user":{"login":"glock45","id":492449,"avatar_url":"https://avatars.githubusercontent.com/u/492449?v=3","gravatar_id":"","url":"https://api.github.com/users/glock45","html_url":"https://github.com/glock45","followers_url":"https://api.github.com/users/glock45/followers","following_url":"https://api.github.com/users/glock45/following{/other_user}","gists_url":"https://api.github.com/users/glock45/gists{/gist_id}","starred_url":"https://api.github.com/users/glock45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glock45/subscriptions","organizations_url":"https://api.github.com/users/glock45/orgs","repos_url":"https://api.github.com/users/glock45/repos","events_url":"https://api.github.com/users/glock45/events{/privacy}","received_events_url":"https://api.github.com/users/glock45/received_events","type":"User","site_admin":false},"repo":{"id":20571593,"name":"swifter","full_name":"glock45/swifter","owner":{"login":"glock45","id":492449,"avatar_url":"https://avatars.githubusercontent.com/u/492449?v=3","gravatar_id":"","url":"https://api.github.com/users/glock45","html_url":"https://github.com/glock45","followers_url":"https://api.github.com/users/glock45/followers","following_url":"https://api.github.com/users/glock45/following{/other_user}","gists_url":"https://api.github.com/users/glock45/gists{/gist_id}","starred_url":"https://api.github.com/users/glock45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glock45/subscriptions","organizations_url":"https://api.github.com/users/glock45/orgs","repos_url":"https://api.github.com/users/glock45/repos","events_url":"https://api.github.com/users/glock45/events{/privacy}","received_events_url":"https://api.github.com/users/glock45/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glock45/swifter","description":"Tiny http server engine written in Swift programming language.","fork":false,"url":"https://api.github.com/repos/glock45/swifter","forks_url":"https://api.github.com/repos/glock45/swifter/forks","keys_url":"https://api.github.com/repos/glock45/swifter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glock45/swifter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glock45/swifter/teams","hooks_url":"https://api.github.com/repos/glock45/swifter/hooks","issue_events_url":"https://api.github.com/repos/glock45/swifter/issues/events{/number}","events_url":"https://api.github.com/repos/glock45/swifter/events","assignees_url":"https://api.github.com/repos/glock45/swifter/assignees{/user}","branches_url":"https://api.github.com/repos/glock45/swifter/branches{/branch}","tags_url":"https://api.github.com/repos/glock45/swifter/tags","blobs_url":"https://api.github.com/repos/glock45/swifter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glock45/swifter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glock45/swifter/git/refs{/sha}","trees_url":"https://api.github.com/repos/glock45/swifter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glock45/swifter/statuses/{sha}","languages_url":"https://api.github.com/repos/glock45/swifter/languages","stargazers_url":"https://api.github.com/repos/glock45/swifter/stargazers","contributors_url":"https://api.github.com/repos/glock45/swifter/contributors","subscribers_url":"https://api.github.com/repos/glock45/swifter/subscribers","subscription_url":"https://api.github.com/repos/glock45/swifter/subscription","commits_url":"https://api.github.com/repos/glock45/swifter/commits{/sha}","git_commits_url":"https://api.github.com/repos/glock45/swifter/git/commits{/sha}","comments_url":"https://api.github.com/repos/glock45/swifter/comments{/number}","issue_comment_url":"https://api.github.com/repos/glock45/swifter/issues/comments{/number}","contents_url":"https://api.github.com/repos/glock45/swifter/contents/{+path}","compare_url":"https://api.github.com/repos/glock45/swifter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glock45/swifter/merges","archive_url":"https://api.github.com/repos/glock45/swifter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glock45/swifter/downloads","issues_url":"https://api.github.com/repos/glock45/swifter/issues{/number}","pulls_url":"https://api.github.com/repos/glock45/swifter/pulls{/number}","milestones_url":"https://api.github.com/repos/glock45/swifter/milestones{/number}","notifications_url":"https://api.github.com/repos/glock45/swifter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glock45/swifter/labels{/name}","releases_url":"https://api.github.com/repos/glock45/swifter/releases{/id}","created_at":"2014-06-06T17:07:31Z","updated_at":"2015-12-16T06:47:52Z","pushed_at":"2015-12-15T23:43:45Z","git_url":"git://github.com/glock45/swifter.git","ssh_url":"git@github.com:glock45/swifter.git","clone_url":"https://github.com/glock45/swifter.git","svn_url":"https://github.com/glock45/swifter","homepage":null,"size":6755,"stargazers_count":1236,"watchers_count":1236,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":144,"mirror_url":null,"open_issues_count":10,"forks":144,"open_issues":10,"watchers":1236,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/glock45/swifter/pulls/79"},"html":{"href":"https://github.com/glock45/swifter/pull/79"},"issue":{"href":"https://api.github.com/repos/glock45/swifter/issues/79"},"comments":{"href":"https://api.github.com/repos/glock45/swifter/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/glock45/swifter/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/glock45/swifter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/glock45/swifter/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/glock45/swifter/statuses/ae60b6aa434b4486a1c6815ae198e4bf105701bb"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":129,"deletions":44,"changed_files":6}}