{"action":"created","comment":{"url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/comments/206998720","pull_request_review_id":142521958,"id":206998720,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjk5ODcyMA==","diff_hunk":"@@ -0,0 +1,44 @@\n+defmodule ExLimiter.PlugTest do\n+  use ExUnit.Case\n+  use Plug.Test\n+  alias ExLimiter.TestUtils \n+\n+  describe \"#call/2\" do\n+    setup [:setup_limiter, :setup_conn]\n+    \n+    test \"It will supply rate limiting headers if it passes\", %{limiter: config, conn: conn} do\n+      conn =\n+        conn\n+        |> ExLimiter.Plug.call(config)\n+\n+      refute Enum.empty?(get_resp_header(conn, \"x-ratelimit-limit\"))\n+      refute Enum.empty?(get_resp_header(conn, \"x-ratelimit-window\"))\n+      refute Enum.empty?(get_resp_header(conn, \"x-ratelimit-remaining\"))\n+    end\n+\n+    test \"It will reject if the rate limit has been exceeded\", %{limiter: config, conn: conn} do\n+      conn =\n+        %{conn | params: %{\"count\" => 11}}\n+         |> ExLimiter.Plug.call(config)\n+\n+      assert conn.status == 429\n+    end\n+  end\n+\n+  defp setup_conn(_) do \n+    random =  TestUtils.rand_string()\n+    conn =\n+      conn(:get, \"/\")\n+      |> merge_private(phoenix_controller: random, phoenix_action: random)\n+\n+    [conn: conn]\n+  end\n+","path":"test/ex_limiter/plug_test.exs","position":36,"original_position":36,"commit_id":"3eda90baf50fc0afc93b05d1b7803280e4a3315c","original_commit_id":"3eda90baf50fc0afc93b05d1b7803280e4a3315c","user":{"login":"elijahkim","id":8673900,"node_id":"MDQ6VXNlcjg2NzM5MDA=","avatar_url":"https://avatars0.githubusercontent.com/u/8673900?v=4","gravatar_id":"","url":"https://api.github.com/users/elijahkim","html_url":"https://github.com/elijahkim","followers_url":"https://api.github.com/users/elijahkim/followers","following_url":"https://api.github.com/users/elijahkim/following{/other_user}","gists_url":"https://api.github.com/users/elijahkim/gists{/gist_id}","starred_url":"https://api.github.com/users/elijahkim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elijahkim/subscriptions","organizations_url":"https://api.github.com/users/elijahkim/orgs","repos_url":"https://api.github.com/users/elijahkim/repos","events_url":"https://api.github.com/users/elijahkim/events{/privacy}","received_events_url":"https://api.github.com/users/elijahkim/received_events","type":"User","site_admin":false},"body":"another nit lol sorry I missed it","created_at":"2018-08-01T19:09:19Z","updated_at":"2018-08-01T19:09:20Z","html_url":"https://github.com/Frameio/ex_limiter/pull/1#discussion_r206998720","pull_request_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/comments/206998720"},"html":{"href":"https://github.com/Frameio/ex_limiter/pull/1#discussion_r206998720"},"pull_request":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1","id":205491041,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NDkxMDQx","html_url":"https://github.com/Frameio/ex_limiter/pull/1","diff_url":"https://github.com/Frameio/ex_limiter/pull/1.diff","patch_url":"https://github.com/Frameio/ex_limiter/pull/1.patch","issue_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/1","number":1,"state":"open","locked":false,"title":"Token Bucket rate limiter","user":{"login":"michaeljguarino","id":3838088,"node_id":"MDQ6VXNlcjM4MzgwODg=","avatar_url":"https://avatars2.githubusercontent.com/u/3838088?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljguarino","html_url":"https://github.com/michaeljguarino","followers_url":"https://api.github.com/users/michaeljguarino/followers","following_url":"https://api.github.com/users/michaeljguarino/following{/other_user}","gists_url":"https://api.github.com/users/michaeljguarino/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljguarino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljguarino/subscriptions","organizations_url":"https://api.github.com/users/michaeljguarino/orgs","repos_url":"https://api.github.com/users/michaeljguarino/repos","events_url":"https://api.github.com/users/michaeljguarino/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljguarino/received_events","type":"User","site_admin":false},"body":"\nSupports configurable storage backends (with a memcached based solution built-in), and implements\na plug for enforcing rate limits with additional configuration for bucket inference and the consumption\nof the rate limit on the request.","created_at":"2018-08-01T17:01:30Z","updated_at":"2018-08-01T19:09:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d3e36429a42dcce493121fd34ddfb20096f0a68","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/1/comments","statuses_url":"https://api.github.com/repos/Frameio/ex_limiter/statuses/3eda90baf50fc0afc93b05d1b7803280e4a3315c","head":{"label":"Frameio:mguarino/first_pass","ref":"mguarino/first_pass","sha":"3eda90baf50fc0afc93b05d1b7803280e4a3315c","user":{"login":"Frameio","id":8882715,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4ODI3MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/8882715?v=4","gravatar_id":"","url":"https://api.github.com/users/Frameio","html_url":"https://github.com/Frameio","followers_url":"https://api.github.com/users/Frameio/followers","following_url":"https://api.github.com/users/Frameio/following{/other_user}","gists_url":"https://api.github.com/users/Frameio/gists{/gist_id}","starred_url":"https://api.github.com/users/Frameio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frameio/subscriptions","organizations_url":"https://api.github.com/users/Frameio/orgs","repos_url":"https://api.github.com/users/Frameio/repos","events_url":"https://api.github.com/users/Frameio/events{/privacy}","received_events_url":"https://api.github.com/users/Frameio/received_events","type":"Organization","site_admin":false},"repo":{"id":143077854,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNzc4NTQ=","name":"ex_limiter","full_name":"Frameio/ex_limiter","owner":{"login":"Frameio","id":8882715,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4ODI3MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/8882715?v=4","gravatar_id":"","url":"https://api.github.com/users/Frameio","html_url":"https://github.com/Frameio","followers_url":"https://api.github.com/users/Frameio/followers","following_url":"https://api.github.com/users/Frameio/following{/other_user}","gists_url":"https://api.github.com/users/Frameio/gists{/gist_id}","starred_url":"https://api.github.com/users/Frameio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frameio/subscriptions","organizations_url":"https://api.github.com/users/Frameio/orgs","repos_url":"https://api.github.com/users/Frameio/repos","events_url":"https://api.github.com/users/Frameio/events{/privacy}","received_events_url":"https://api.github.com/users/Frameio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Frameio/ex_limiter","description":"Rate Limiter written in elixir with configurable backends","fork":false,"url":"https://api.github.com/repos/Frameio/ex_limiter","forks_url":"https://api.github.com/repos/Frameio/ex_limiter/forks","keys_url":"https://api.github.com/repos/Frameio/ex_limiter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Frameio/ex_limiter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Frameio/ex_limiter/teams","hooks_url":"https://api.github.com/repos/Frameio/ex_limiter/hooks","issue_events_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/events{/number}","events_url":"https://api.github.com/repos/Frameio/ex_limiter/events","assignees_url":"https://api.github.com/repos/Frameio/ex_limiter/assignees{/user}","branches_url":"https://api.github.com/repos/Frameio/ex_limiter/branches{/branch}","tags_url":"https://api.github.com/repos/Frameio/ex_limiter/tags","blobs_url":"https://api.github.com/repos/Frameio/ex_limiter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Frameio/ex_limiter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Frameio/ex_limiter/git/refs{/sha}","trees_url":"https://api.github.com/repos/Frameio/ex_limiter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Frameio/ex_limiter/statuses/{sha}","languages_url":"https://api.github.com/repos/Frameio/ex_limiter/languages","stargazers_url":"https://api.github.com/repos/Frameio/ex_limiter/stargazers","contributors_url":"https://api.github.com/repos/Frameio/ex_limiter/contributors","subscribers_url":"https://api.github.com/repos/Frameio/ex_limiter/subscribers","subscription_url":"https://api.github.com/repos/Frameio/ex_limiter/subscription","commits_url":"https://api.github.com/repos/Frameio/ex_limiter/commits{/sha}","git_commits_url":"https://api.github.com/repos/Frameio/ex_limiter/git/commits{/sha}","comments_url":"https://api.github.com/repos/Frameio/ex_limiter/comments{/number}","issue_comment_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/comments{/number}","contents_url":"https://api.github.com/repos/Frameio/ex_limiter/contents/{+path}","compare_url":"https://api.github.com/repos/Frameio/ex_limiter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Frameio/ex_limiter/merges","archive_url":"https://api.github.com/repos/Frameio/ex_limiter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Frameio/ex_limiter/downloads","issues_url":"https://api.github.com/repos/Frameio/ex_limiter/issues{/number}","pulls_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls{/number}","milestones_url":"https://api.github.com/repos/Frameio/ex_limiter/milestones{/number}","notifications_url":"https://api.github.com/repos/Frameio/ex_limiter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Frameio/ex_limiter/labels{/name}","releases_url":"https://api.github.com/repos/Frameio/ex_limiter/releases{/id}","deployments_url":"https://api.github.com/repos/Frameio/ex_limiter/deployments","created_at":"2018-07-31T22:51:44Z","updated_at":"2018-07-31T22:51:46Z","pushed_at":"2018-08-01T18:39:18Z","git_url":"git://github.com/Frameio/ex_limiter.git","ssh_url":"git@github.com:Frameio/ex_limiter.git","clone_url":"https://github.com/Frameio/ex_limiter.git","svn_url":"https://github.com/Frameio/ex_limiter","homepage":null,"size":9,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Frameio:master","ref":"master","sha":"91971d090fc0984f0e32313fe8b698e4a893faa6","user":{"login":"Frameio","id":8882715,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4ODI3MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/8882715?v=4","gravatar_id":"","url":"https://api.github.com/users/Frameio","html_url":"https://github.com/Frameio","followers_url":"https://api.github.com/users/Frameio/followers","following_url":"https://api.github.com/users/Frameio/following{/other_user}","gists_url":"https://api.github.com/users/Frameio/gists{/gist_id}","starred_url":"https://api.github.com/users/Frameio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frameio/subscriptions","organizations_url":"https://api.github.com/users/Frameio/orgs","repos_url":"https://api.github.com/users/Frameio/repos","events_url":"https://api.github.com/users/Frameio/events{/privacy}","received_events_url":"https://api.github.com/users/Frameio/received_events","type":"Organization","site_admin":false},"repo":{"id":143077854,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNzc4NTQ=","name":"ex_limiter","full_name":"Frameio/ex_limiter","owner":{"login":"Frameio","id":8882715,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4ODI3MTU=","avatar_url":"https://avatars0.githubusercontent.com/u/8882715?v=4","gravatar_id":"","url":"https://api.github.com/users/Frameio","html_url":"https://github.com/Frameio","followers_url":"https://api.github.com/users/Frameio/followers","following_url":"https://api.github.com/users/Frameio/following{/other_user}","gists_url":"https://api.github.com/users/Frameio/gists{/gist_id}","starred_url":"https://api.github.com/users/Frameio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frameio/subscriptions","organizations_url":"https://api.github.com/users/Frameio/orgs","repos_url":"https://api.github.com/users/Frameio/repos","events_url":"https://api.github.com/users/Frameio/events{/privacy}","received_events_url":"https://api.github.com/users/Frameio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Frameio/ex_limiter","description":"Rate Limiter written in elixir with configurable backends","fork":false,"url":"https://api.github.com/repos/Frameio/ex_limiter","forks_url":"https://api.github.com/repos/Frameio/ex_limiter/forks","keys_url":"https://api.github.com/repos/Frameio/ex_limiter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Frameio/ex_limiter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Frameio/ex_limiter/teams","hooks_url":"https://api.github.com/repos/Frameio/ex_limiter/hooks","issue_events_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/events{/number}","events_url":"https://api.github.com/repos/Frameio/ex_limiter/events","assignees_url":"https://api.github.com/repos/Frameio/ex_limiter/assignees{/user}","branches_url":"https://api.github.com/repos/Frameio/ex_limiter/branches{/branch}","tags_url":"https://api.github.com/repos/Frameio/ex_limiter/tags","blobs_url":"https://api.github.com/repos/Frameio/ex_limiter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Frameio/ex_limiter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Frameio/ex_limiter/git/refs{/sha}","trees_url":"https://api.github.com/repos/Frameio/ex_limiter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Frameio/ex_limiter/statuses/{sha}","languages_url":"https://api.github.com/repos/Frameio/ex_limiter/languages","stargazers_url":"https://api.github.com/repos/Frameio/ex_limiter/stargazers","contributors_url":"https://api.github.com/repos/Frameio/ex_limiter/contributors","subscribers_url":"https://api.github.com/repos/Frameio/ex_limiter/subscribers","subscription_url":"https://api.github.com/repos/Frameio/ex_limiter/subscription","commits_url":"https://api.github.com/repos/Frameio/ex_limiter/commits{/sha}","git_commits_url":"https://api.github.com/repos/Frameio/ex_limiter/git/commits{/sha}","comments_url":"https://api.github.com/repos/Frameio/ex_limiter/comments{/number}","issue_comment_url":"https://api.github.com/repos/Frameio/ex_limiter/issues/comments{/number}","contents_url":"https://api.github.com/repos/Frameio/ex_limiter/contents/{+path}","compare_url":"https://api.github.com/repos/Frameio/ex_limiter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Frameio/ex_limiter/merges","archive_url":"https://api.github.com/repos/Frameio/ex_limiter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Frameio/ex_limiter/downloads","issues_url":"https://api.github.com/repos/Frameio/ex_limiter/issues{/number}","pulls_url":"https://api.github.com/repos/Frameio/ex_limiter/pulls{/number}","milestones_url":"https://api.github.com/repos/Frameio/ex_limiter/milestones{/number}","notifications_url":"https://api.github.com/repos/Frameio/ex_limiter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Frameio/ex_limiter/labels{/name}","releases_url":"https://api.github.com/repos/Frameio/ex_limiter/releases{/id}","deployments_url":"https://api.github.com/repos/Frameio/ex_limiter/deployments","created_at":"2018-07-31T22:51:44Z","updated_at":"2018-07-31T22:51:46Z","pushed_at":"2018-08-01T18:39:18Z","git_url":"git://github.com/Frameio/ex_limiter.git","ssh_url":"git@github.com:Frameio/ex_limiter.git","clone_url":"https://github.com/Frameio/ex_limiter.git","svn_url":"https://github.com/Frameio/ex_limiter","homepage":null,"size":9,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1"},"html":{"href":"https://github.com/Frameio/ex_limiter/pull/1"},"issue":{"href":"https://api.github.com/repos/Frameio/ex_limiter/issues/1"},"comments":{"href":"https://api.github.com/repos/Frameio/ex_limiter/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Frameio/ex_limiter/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Frameio/ex_limiter/statuses/3eda90baf50fc0afc93b05d1b7803280e4a3315c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"elijahkim"}}