{"action":"created","comment":{"url":"https://api.github.com/repos/luckyframework/lucky/pulls/comments/223093405","pull_request_review_id":162144749,"id":223093405,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzA5MzQwNQ==","diff_hunk":"@@ -4,9 +4,31 @@ class Lucky::SessionHandler\n   def call(context : HTTP::Server::Context)\n     call_next(context)\n \n-    if context.session.changed?\n-      context.session.set_session\n-      context.cookies.write(context.response.headers)\n+    write_session(context)\n+    write_cookies(context)\n+    check_cookie_size(context)\n+  end\n+\n+  private def write_session(context : HTTP::Server::Context)\n+    return if !context.session.changed?","path":"src/lucky/session_handler.cr","position":null,"original_position":13,"commit_id":"8cca80f3655321e9b2c4a35e9609e40e4baa7288","original_commit_id":"c9ff47a151786cf05c3957f74a4efbb4dfa90023","user":{"login":"edwardloveall","id":49549,"node_id":"MDQ6VXNlcjQ5NTQ5","avatar_url":"https://avatars1.githubusercontent.com/u/49549?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardloveall","html_url":"https://github.com/edwardloveall","followers_url":"https://api.github.com/users/edwardloveall/followers","following_url":"https://api.github.com/users/edwardloveall/following{/other_user}","gists_url":"https://api.github.com/users/edwardloveall/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardloveall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardloveall/subscriptions","organizations_url":"https://api.github.com/users/edwardloveall/orgs","repos_url":"https://api.github.com/users/edwardloveall/repos","events_url":"https://api.github.com/users/edwardloveall/events{/privacy}","received_events_url":"https://api.github.com/users/edwardloveall/received_events","type":"User","site_admin":false},"body":"Nailed it: 8cca80f3","created_at":"2018-10-05T18:02:28Z","updated_at":"2018-10-05T18:02:28Z","html_url":"https://github.com/luckyframework/lucky/pull/609#discussion_r223093405","pull_request_url":"https://api.github.com/repos/luckyframework/lucky/pulls/609","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/comments/223093405"},"html":{"href":"https://github.com/luckyframework/lucky/pull/609#discussion_r223093405"},"pull_request":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/609"}},"in_reply_to_id":222517758},"pull_request":{"url":"https://api.github.com/repos/luckyframework/lucky/pulls/609","id":215694000,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1Njk0MDAw","html_url":"https://github.com/luckyframework/lucky/pull/609","diff_url":"https://github.com/luckyframework/lucky/pull/609.diff","patch_url":"https://github.com/luckyframework/lucky/pull/609.patch","issue_url":"https://api.github.com/repos/luckyframework/lucky/issues/609","number":609,"state":"open","locked":false,"title":"Refactor the cookie system","user":{"login":"edwardloveall","id":49549,"node_id":"MDQ6VXNlcjQ5NTQ5","avatar_url":"https://avatars1.githubusercontent.com/u/49549?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardloveall","html_url":"https://github.com/edwardloveall","followers_url":"https://api.github.com/users/edwardloveall/followers","following_url":"https://api.github.com/users/edwardloveall/following{/other_user}","gists_url":"https://api.github.com/users/edwardloveall/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardloveall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardloveall/subscriptions","organizations_url":"https://api.github.com/users/edwardloveall/orgs","repos_url":"https://api.github.com/users/edwardloveall/repos","events_url":"https://api.github.com/users/edwardloveall/events{/privacy}","received_events_url":"https://api.github.com/users/edwardloveall/received_events","type":"User","site_admin":false},"body":"The tl;dr of this is:\r\n\r\n* Cookie sub-system has been refactored to be more safe and debuggable\r\n* Now you use `cookies.set(:key, \"value\")`, `cookies.get(:key)`, and `cookies.get?(:key)`\r\n* Old `[]=`, `[]`, and `[]?` syntax doesn't work\r\n* Flash is has `success`, `info`, and `failure` keys now (instead of `warning`)\r\n* You'll want to make sure you have a session key configured. probably best to call is `_name_of_app_session`:\r\n\r\n```\r\nLucky::SessionCookie.configure do |settings|\r\n  settings.key = \"_app_session\"\r\nend\r\n```\r\n\r\nSee also:\r\n* https://github.com/luckyframework/lucky_cli/pull/256\r\n* https://github.com/luckyframework/authentic/pull/16","created_at":"2018-09-14T19:50:21Z","updated_at":"2018-10-05T18:02:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0d71de2c2e0b36981d665c27ffbd2ac0fbc2877","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/luckyframework/lucky/pulls/609/commits","review_comments_url":"https://api.github.com/repos/luckyframework/lucky/pulls/609/comments","review_comment_url":"https://api.github.com/repos/luckyframework/lucky/pulls/comments{/number}","comments_url":"https://api.github.com/repos/luckyframework/lucky/issues/609/comments","statuses_url":"https://api.github.com/repos/luckyframework/lucky/statuses/8cca80f3655321e9b2c4a35e9609e40e4baa7288","head":{"label":"luckyframework:el-cookie-refactor","ref":"el-cookie-refactor","sha":"8cca80f3655321e9b2c4a35e9609e40e4baa7288","user":{"login":"luckyframework","id":24882045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODgyMDQ1","avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"repo":{"id":78238350,"node_id":"MDEwOlJlcG9zaXRvcnk3ODIzODM1MA==","name":"lucky","full_name":"luckyframework/lucky","private":false,"owner":{"login":"luckyframework","id":24882045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODgyMDQ1","avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/luckyframework/lucky","description":"A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.","fork":false,"url":"https://api.github.com/repos/luckyframework/lucky","forks_url":"https://api.github.com/repos/luckyframework/lucky/forks","keys_url":"https://api.github.com/repos/luckyframework/lucky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luckyframework/lucky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luckyframework/lucky/teams","hooks_url":"https://api.github.com/repos/luckyframework/lucky/hooks","issue_events_url":"https://api.github.com/repos/luckyframework/lucky/issues/events{/number}","events_url":"https://api.github.com/repos/luckyframework/lucky/events","assignees_url":"https://api.github.com/repos/luckyframework/lucky/assignees{/user}","branches_url":"https://api.github.com/repos/luckyframework/lucky/branches{/branch}","tags_url":"https://api.github.com/repos/luckyframework/lucky/tags","blobs_url":"https://api.github.com/repos/luckyframework/lucky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luckyframework/lucky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luckyframework/lucky/git/refs{/sha}","trees_url":"https://api.github.com/repos/luckyframework/lucky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luckyframework/lucky/statuses/{sha}","languages_url":"https://api.github.com/repos/luckyframework/lucky/languages","stargazers_url":"https://api.github.com/repos/luckyframework/lucky/stargazers","contributors_url":"https://api.github.com/repos/luckyframework/lucky/contributors","subscribers_url":"https://api.github.com/repos/luckyframework/lucky/subscribers","subscription_url":"https://api.github.com/repos/luckyframework/lucky/subscription","commits_url":"https://api.github.com/repos/luckyframework/lucky/commits{/sha}","git_commits_url":"https://api.github.com/repos/luckyframework/lucky/git/commits{/sha}","comments_url":"https://api.github.com/repos/luckyframework/lucky/comments{/number}","issue_comment_url":"https://api.github.com/repos/luckyframework/lucky/issues/comments{/number}","contents_url":"https://api.github.com/repos/luckyframework/lucky/contents/{+path}","compare_url":"https://api.github.com/repos/luckyframework/lucky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luckyframework/lucky/merges","archive_url":"https://api.github.com/repos/luckyframework/lucky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luckyframework/lucky/downloads","issues_url":"https://api.github.com/repos/luckyframework/lucky/issues{/number}","pulls_url":"https://api.github.com/repos/luckyframework/lucky/pulls{/number}","milestones_url":"https://api.github.com/repos/luckyframework/lucky/milestones{/number}","notifications_url":"https://api.github.com/repos/luckyframework/lucky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luckyframework/lucky/labels{/name}","releases_url":"https://api.github.com/repos/luckyframework/lucky/releases{/id}","deployments_url":"https://api.github.com/repos/luckyframework/lucky/deployments","created_at":"2017-01-06T20:58:57Z","updated_at":"2018-10-05T17:55:37Z","pushed_at":"2018-10-05T18:01:50Z","git_url":"git://github.com/luckyframework/lucky.git","ssh_url":"git@github.com:luckyframework/lucky.git","clone_url":"https://github.com/luckyframework/lucky.git","svn_url":"https://github.com/luckyframework/lucky","homepage":"https://luckyframework.org","size":762,"stargazers_count":1148,"watchers_count":1148,"language":"Crystal","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":68,"mirror_url":null,"archived":false,"open_issues_count":83,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":68,"open_issues":83,"watchers":1148,"default_branch":"master"}},"base":{"label":"luckyframework:master","ref":"master","sha":"2085f7dad915dc193790576c4a790d8e6c276cde","user":{"login":"luckyframework","id":24882045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODgyMDQ1","avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"repo":{"id":78238350,"node_id":"MDEwOlJlcG9zaXRvcnk3ODIzODM1MA==","name":"lucky","full_name":"luckyframework/lucky","private":false,"owner":{"login":"luckyframework","id":24882045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0ODgyMDQ1","avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/luckyframework/lucky","description":"A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.","fork":false,"url":"https://api.github.com/repos/luckyframework/lucky","forks_url":"https://api.github.com/repos/luckyframework/lucky/forks","keys_url":"https://api.github.com/repos/luckyframework/lucky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luckyframework/lucky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luckyframework/lucky/teams","hooks_url":"https://api.github.com/repos/luckyframework/lucky/hooks","issue_events_url":"https://api.github.com/repos/luckyframework/lucky/issues/events{/number}","events_url":"https://api.github.com/repos/luckyframework/lucky/events","assignees_url":"https://api.github.com/repos/luckyframework/lucky/assignees{/user}","branches_url":"https://api.github.com/repos/luckyframework/lucky/branches{/branch}","tags_url":"https://api.github.com/repos/luckyframework/lucky/tags","blobs_url":"https://api.github.com/repos/luckyframework/lucky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luckyframework/lucky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luckyframework/lucky/git/refs{/sha}","trees_url":"https://api.github.com/repos/luckyframework/lucky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luckyframework/lucky/statuses/{sha}","languages_url":"https://api.github.com/repos/luckyframework/lucky/languages","stargazers_url":"https://api.github.com/repos/luckyframework/lucky/stargazers","contributors_url":"https://api.github.com/repos/luckyframework/lucky/contributors","subscribers_url":"https://api.github.com/repos/luckyframework/lucky/subscribers","subscription_url":"https://api.github.com/repos/luckyframework/lucky/subscription","commits_url":"https://api.github.com/repos/luckyframework/lucky/commits{/sha}","git_commits_url":"https://api.github.com/repos/luckyframework/lucky/git/commits{/sha}","comments_url":"https://api.github.com/repos/luckyframework/lucky/comments{/number}","issue_comment_url":"https://api.github.com/repos/luckyframework/lucky/issues/comments{/number}","contents_url":"https://api.github.com/repos/luckyframework/lucky/contents/{+path}","compare_url":"https://api.github.com/repos/luckyframework/lucky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luckyframework/lucky/merges","archive_url":"https://api.github.com/repos/luckyframework/lucky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luckyframework/lucky/downloads","issues_url":"https://api.github.com/repos/luckyframework/lucky/issues{/number}","pulls_url":"https://api.github.com/repos/luckyframework/lucky/pulls{/number}","milestones_url":"https://api.github.com/repos/luckyframework/lucky/milestones{/number}","notifications_url":"https://api.github.com/repos/luckyframework/lucky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luckyframework/lucky/labels{/name}","releases_url":"https://api.github.com/repos/luckyframework/lucky/releases{/id}","deployments_url":"https://api.github.com/repos/luckyframework/lucky/deployments","created_at":"2017-01-06T20:58:57Z","updated_at":"2018-10-05T17:55:37Z","pushed_at":"2018-10-05T18:01:50Z","git_url":"git://github.com/luckyframework/lucky.git","ssh_url":"git@github.com:luckyframework/lucky.git","clone_url":"https://github.com/luckyframework/lucky.git","svn_url":"https://github.com/luckyframework/lucky","homepage":"https://luckyframework.org","size":762,"stargazers_count":1148,"watchers_count":1148,"language":"Crystal","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":68,"mirror_url":null,"archived":false,"open_issues_count":83,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":68,"open_issues":83,"watchers":1148,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/609"},"html":{"href":"https://github.com/luckyframework/lucky/pull/609"},"issue":{"href":"https://api.github.com/repos/luckyframework/lucky/issues/609"},"comments":{"href":"https://api.github.com/repos/luckyframework/lucky/issues/609/comments"},"review_comments":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/609/comments"},"review_comment":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/luckyframework/lucky/pulls/609/commits"},"statuses":{"href":"https://api.github.com/repos/luckyframework/lucky/statuses/8cca80f3655321e9b2c4a35e9609e40e4baa7288"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"edwardloveall"}}