{"action":"created","comment":{"url":"https://api.github.com/repos/sdogruyol/kemal/pulls/comments/52721774","id":52721774,"diff_hunk":"@@ -35,18 +47,25 @@ module Kemal::Middleware\n     def initialize(&@block : HTTP::Server::Context -> _)\n     end\n   end\n+\n end\n \n def add_filters\n-  Kemal.config.add_handler Kemal::Middleware::Filter.new\n+  unless filter = Kemal.config.handlers.any? { |handler| handler.is_a? Kemal::Middleware::Filter }\n+    filter = Kemal::Middleware::Filter.new","path":"src/kemal/middleware/filters.cr","position":36,"original_position":36,"commit_id":"7abf6629cf9eaa411d6394b0004fe633452563b1","original_commit_id":"7abf6629cf9eaa411d6394b0004fe633452563b1","user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"body":"No need to create a variable here","created_at":"2016-02-12T09:49:30Z","updated_at":"2016-02-12T09:49:30Z","html_url":"https://github.com/sdogruyol/kemal/pull/85#discussion_r52721774","pull_request_url":"https://api.github.com/repos/sdogruyol/kemal/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/comments/52721774"},"html":{"href":"https://github.com/sdogruyol/kemal/pull/85#discussion_r52721774"},"pull_request":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/sdogruyol/kemal/pulls/85","id":59150492,"html_url":"https://github.com/sdogruyol/kemal/pull/85","diff_url":"https://github.com/sdogruyol/kemal/pull/85.diff","patch_url":"https://github.com/sdogruyol/kemal/pull/85.patch","issue_url":"https://api.github.com/repos/sdogruyol/kemal/issues/85","number":85,"state":"open","locked":false,"title":"Fix filter middleware","user":{"login":"jmoriau","id":13310881,"avatar_url":"https://avatars.githubusercontent.com/u/13310881?v=3","gravatar_id":"","url":"https://api.github.com/users/jmoriau","html_url":"https://github.com/jmoriau","followers_url":"https://api.github.com/users/jmoriau/followers","following_url":"https://api.github.com/users/jmoriau/following{/other_user}","gists_url":"https://api.github.com/users/jmoriau/gists{/gist_id}","starred_url":"https://api.github.com/users/jmoriau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmoriau/subscriptions","organizations_url":"https://api.github.com/users/jmoriau/orgs","repos_url":"https://api.github.com/users/jmoriau/repos","events_url":"https://api.github.com/users/jmoriau/events{/privacy}","received_events_url":"https://api.github.com/users/jmoriau/received_events","type":"User","site_admin":false},"body":"- `add_filters` no longer needs to be called explicitly it will be lazily called if needed.\r\n- the Filter middleware no longer needs to be the first in the handlers array.\r\n- `before` and `after` methods will raise an exception if a filter for the requested path is already defined.","created_at":"2016-02-12T09:37:22Z","updated_at":"2016-02-12T09:49:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bbe89bffa6e23dd8a26634186f9b1971c91b32f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sdogruyol/kemal/pulls/85/commits","review_comments_url":"https://api.github.com/repos/sdogruyol/kemal/pulls/85/comments","review_comment_url":"https://api.github.com/repos/sdogruyol/kemal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sdogruyol/kemal/issues/85/comments","statuses_url":"https://api.github.com/repos/sdogruyol/kemal/statuses/7abf6629cf9eaa411d6394b0004fe633452563b1","head":{"label":"jmoriau:fix-filter-middleware","ref":"fix-filter-middleware","sha":"7abf6629cf9eaa411d6394b0004fe633452563b1","user":{"login":"jmoriau","id":13310881,"avatar_url":"https://avatars.githubusercontent.com/u/13310881?v=3","gravatar_id":"","url":"https://api.github.com/users/jmoriau","html_url":"https://github.com/jmoriau","followers_url":"https://api.github.com/users/jmoriau/followers","following_url":"https://api.github.com/users/jmoriau/following{/other_user}","gists_url":"https://api.github.com/users/jmoriau/gists{/gist_id}","starred_url":"https://api.github.com/users/jmoriau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmoriau/subscriptions","organizations_url":"https://api.github.com/users/jmoriau/orgs","repos_url":"https://api.github.com/users/jmoriau/repos","events_url":"https://api.github.com/users/jmoriau/events{/privacy}","received_events_url":"https://api.github.com/users/jmoriau/received_events","type":"User","site_admin":false},"repo":{"id":51578033,"name":"kemal","full_name":"jmoriau/kemal","owner":{"login":"jmoriau","id":13310881,"avatar_url":"https://avatars.githubusercontent.com/u/13310881?v=3","gravatar_id":"","url":"https://api.github.com/users/jmoriau","html_url":"https://github.com/jmoriau","followers_url":"https://api.github.com/users/jmoriau/followers","following_url":"https://api.github.com/users/jmoriau/following{/other_user}","gists_url":"https://api.github.com/users/jmoriau/gists{/gist_id}","starred_url":"https://api.github.com/users/jmoriau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmoriau/subscriptions","organizations_url":"https://api.github.com/users/jmoriau/orgs","repos_url":"https://api.github.com/users/jmoriau/repos","events_url":"https://api.github.com/users/jmoriau/events{/privacy}","received_events_url":"https://api.github.com/users/jmoriau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmoriau/kemal","description":"Lightning Fast, Super Simple web framework for Crystal","fork":true,"url":"https://api.github.com/repos/jmoriau/kemal","forks_url":"https://api.github.com/repos/jmoriau/kemal/forks","keys_url":"https://api.github.com/repos/jmoriau/kemal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmoriau/kemal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmoriau/kemal/teams","hooks_url":"https://api.github.com/repos/jmoriau/kemal/hooks","issue_events_url":"https://api.github.com/repos/jmoriau/kemal/issues/events{/number}","events_url":"https://api.github.com/repos/jmoriau/kemal/events","assignees_url":"https://api.github.com/repos/jmoriau/kemal/assignees{/user}","branches_url":"https://api.github.com/repos/jmoriau/kemal/branches{/branch}","tags_url":"https://api.github.com/repos/jmoriau/kemal/tags","blobs_url":"https://api.github.com/repos/jmoriau/kemal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmoriau/kemal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmoriau/kemal/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmoriau/kemal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmoriau/kemal/statuses/{sha}","languages_url":"https://api.github.com/repos/jmoriau/kemal/languages","stargazers_url":"https://api.github.com/repos/jmoriau/kemal/stargazers","contributors_url":"https://api.github.com/repos/jmoriau/kemal/contributors","subscribers_url":"https://api.github.com/repos/jmoriau/kemal/subscribers","subscription_url":"https://api.github.com/repos/jmoriau/kemal/subscription","commits_url":"https://api.github.com/repos/jmoriau/kemal/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmoriau/kemal/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmoriau/kemal/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmoriau/kemal/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmoriau/kemal/contents/{+path}","compare_url":"https://api.github.com/repos/jmoriau/kemal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmoriau/kemal/merges","archive_url":"https://api.github.com/repos/jmoriau/kemal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmoriau/kemal/downloads","issues_url":"https://api.github.com/repos/jmoriau/kemal/issues{/number}","pulls_url":"https://api.github.com/repos/jmoriau/kemal/pulls{/number}","milestones_url":"https://api.github.com/repos/jmoriau/kemal/milestones{/number}","notifications_url":"https://api.github.com/repos/jmoriau/kemal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmoriau/kemal/labels{/name}","releases_url":"https://api.github.com/repos/jmoriau/kemal/releases{/id}","deployments_url":"https://api.github.com/repos/jmoriau/kemal/deployments","created_at":"2016-02-12T09:30:31Z","updated_at":"2016-02-12T09:30:32Z","pushed_at":"2016-02-12T09:35:45Z","git_url":"git://github.com/jmoriau/kemal.git","ssh_url":"git@github.com:jmoriau/kemal.git","clone_url":"https://github.com/jmoriau/kemal.git","svn_url":"https://github.com/jmoriau/kemal","homepage":"http://kemalcr.com","size":222,"stargazers_count":0,"watchers_count":0,"language":"Crystal","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":"sdogruyol:master","ref":"master","sha":"454894820da201c56e5067e6d52d2150acd3ed63","user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"repo":{"id":44826364,"name":"kemal","full_name":"sdogruyol/kemal","owner":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sdogruyol/kemal","description":"Lightning Fast, Super Simple web framework for Crystal","fork":false,"url":"https://api.github.com/repos/sdogruyol/kemal","forks_url":"https://api.github.com/repos/sdogruyol/kemal/forks","keys_url":"https://api.github.com/repos/sdogruyol/kemal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdogruyol/kemal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdogruyol/kemal/teams","hooks_url":"https://api.github.com/repos/sdogruyol/kemal/hooks","issue_events_url":"https://api.github.com/repos/sdogruyol/kemal/issues/events{/number}","events_url":"https://api.github.com/repos/sdogruyol/kemal/events","assignees_url":"https://api.github.com/repos/sdogruyol/kemal/assignees{/user}","branches_url":"https://api.github.com/repos/sdogruyol/kemal/branches{/branch}","tags_url":"https://api.github.com/repos/sdogruyol/kemal/tags","blobs_url":"https://api.github.com/repos/sdogruyol/kemal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdogruyol/kemal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdogruyol/kemal/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdogruyol/kemal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdogruyol/kemal/statuses/{sha}","languages_url":"https://api.github.com/repos/sdogruyol/kemal/languages","stargazers_url":"https://api.github.com/repos/sdogruyol/kemal/stargazers","contributors_url":"https://api.github.com/repos/sdogruyol/kemal/contributors","subscribers_url":"https://api.github.com/repos/sdogruyol/kemal/subscribers","subscription_url":"https://api.github.com/repos/sdogruyol/kemal/subscription","commits_url":"https://api.github.com/repos/sdogruyol/kemal/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdogruyol/kemal/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdogruyol/kemal/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdogruyol/kemal/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdogruyol/kemal/contents/{+path}","compare_url":"https://api.github.com/repos/sdogruyol/kemal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdogruyol/kemal/merges","archive_url":"https://api.github.com/repos/sdogruyol/kemal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdogruyol/kemal/downloads","issues_url":"https://api.github.com/repos/sdogruyol/kemal/issues{/number}","pulls_url":"https://api.github.com/repos/sdogruyol/kemal/pulls{/number}","milestones_url":"https://api.github.com/repos/sdogruyol/kemal/milestones{/number}","notifications_url":"https://api.github.com/repos/sdogruyol/kemal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdogruyol/kemal/labels{/name}","releases_url":"https://api.github.com/repos/sdogruyol/kemal/releases{/id}","deployments_url":"https://api.github.com/repos/sdogruyol/kemal/deployments","created_at":"2015-10-23T16:56:29Z","updated_at":"2016-02-11T22:13:36Z","pushed_at":"2016-02-12T09:37:22Z","git_url":"git://github.com/sdogruyol/kemal.git","ssh_url":"git@github.com:sdogruyol/kemal.git","clone_url":"https://github.com/sdogruyol/kemal.git","svn_url":"https://github.com/sdogruyol/kemal","homepage":"http://kemalcr.com","size":221,"stargazers_count":435,"watchers_count":435,"language":"Crystal","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":25,"mirror_url":null,"open_issues_count":8,"forks":25,"open_issues":8,"watchers":435,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/85"},"html":{"href":"https://github.com/sdogruyol/kemal/pull/85"},"issue":{"href":"https://api.github.com/repos/sdogruyol/kemal/issues/85"},"comments":{"href":"https://api.github.com/repos/sdogruyol/kemal/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sdogruyol/kemal/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/sdogruyol/kemal/statuses/7abf6629cf9eaa411d6394b0004fe633452563b1"}}}}