{"action":"opened","number":9,"pull_request":{"url":"https://api.github.com/repos/jayed/gogurl/pulls/9","id":175714466,"html_url":"https://github.com/jayed/gogurl/pull/9","diff_url":"https://github.com/jayed/gogurl/pull/9.diff","patch_url":"https://github.com/jayed/gogurl/pull/9.patch","issue_url":"https://api.github.com/repos/jayed/gogurl/issues/9","number":9,"state":"open","locked":false,"title":"add a form","user":{"login":"brandly","id":820696,"avatar_url":"https://avatars3.githubusercontent.com/u/820696?v=4","gravatar_id":"","url":"https://api.github.com/users/brandly","html_url":"https://github.com/brandly","followers_url":"https://api.github.com/users/brandly/followers","following_url":"https://api.github.com/users/brandly/following{/other_user}","gists_url":"https://api.github.com/users/brandly/gists{/gist_id}","starred_url":"https://api.github.com/users/brandly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandly/subscriptions","organizations_url":"https://api.github.com/users/brandly/orgs","repos_url":"https://api.github.com/users/brandly/repos","events_url":"https://api.github.com/users/brandly/events{/privacy}","received_events_url":"https://api.github.com/users/brandly/received_events","type":"User","site_admin":false},"body":"right now, `POST /links` expects JSON data, so here are our options:\r\n\r\n* change endpoint to take `name` and `url` from `application/x-www-form-urlencoded` data, and change `<form>` to `<form action=\"/links\">`\r\n* add some JS to the page to post JSON, but i'd like some way to write a `.js` file that gets inlined, instead of writing JS in a haskell string. the JS would look something like\r\n\r\n```js\r\ndocument.querySelector('form')\r\n  .addEventListener('submit', function (e) {\r\n    e.preventDefault();\r\n    const body = Array.from(e.target.elements)\r\n      .filter(el => el.type !== 'submit')\r\n      .reduce((out, el) => {\r\n        out[el.name] = el.value\r\n        return out\r\n      }, {});\r\n    fetch('/links', {\r\n      method: 'POST',\r\n      body: JSON.stringify(body)\r\n    }).then(r => {\r\n      if (r.ok) {\r\n        window.location.reload();\r\n      } else {\r\n        console.error(r);\r\n      }\r\n    });\r\n  });\r\n```\r\n\r\ni vote for the first option. we could look at `content-type` and accept either JSON or form data. i'm not sure how to do these things in haskell, cc @mitchellwrosen ","created_at":"2018-03-17T18:31:40Z","updated_at":"2018-03-17T18:31:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jayed/gogurl/pulls/9/commits","review_comments_url":"https://api.github.com/repos/jayed/gogurl/pulls/9/comments","review_comment_url":"https://api.github.com/repos/jayed/gogurl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jayed/gogurl/issues/9/comments","statuses_url":"https://api.github.com/repos/jayed/gogurl/statuses/69d634d8b336794623d58331ae1028c38d062779","head":{"label":"brandly:patch-2","ref":"patch-2","sha":"69d634d8b336794623d58331ae1028c38d062779","user":{"login":"brandly","id":820696,"avatar_url":"https://avatars3.githubusercontent.com/u/820696?v=4","gravatar_id":"","url":"https://api.github.com/users/brandly","html_url":"https://github.com/brandly","followers_url":"https://api.github.com/users/brandly/followers","following_url":"https://api.github.com/users/brandly/following{/other_user}","gists_url":"https://api.github.com/users/brandly/gists{/gist_id}","starred_url":"https://api.github.com/users/brandly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandly/subscriptions","organizations_url":"https://api.github.com/users/brandly/orgs","repos_url":"https://api.github.com/users/brandly/repos","events_url":"https://api.github.com/users/brandly/events{/privacy}","received_events_url":"https://api.github.com/users/brandly/received_events","type":"User","site_admin":false},"repo":{"id":123503060,"name":"gogurl","full_name":"brandly/gogurl","owner":{"login":"brandly","id":820696,"avatar_url":"https://avatars3.githubusercontent.com/u/820696?v=4","gravatar_id":"","url":"https://api.github.com/users/brandly","html_url":"https://github.com/brandly","followers_url":"https://api.github.com/users/brandly/followers","following_url":"https://api.github.com/users/brandly/following{/other_user}","gists_url":"https://api.github.com/users/brandly/gists{/gist_id}","starred_url":"https://api.github.com/users/brandly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandly/subscriptions","organizations_url":"https://api.github.com/users/brandly/orgs","repos_url":"https://api.github.com/users/brandly/repos","events_url":"https://api.github.com/users/brandly/events{/privacy}","received_events_url":"https://api.github.com/users/brandly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brandly/gogurl","description":"gogurl remembers nicknames for URLs and redirects you to the actual URL","fork":true,"url":"https://api.github.com/repos/brandly/gogurl","forks_url":"https://api.github.com/repos/brandly/gogurl/forks","keys_url":"https://api.github.com/repos/brandly/gogurl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brandly/gogurl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brandly/gogurl/teams","hooks_url":"https://api.github.com/repos/brandly/gogurl/hooks","issue_events_url":"https://api.github.com/repos/brandly/gogurl/issues/events{/number}","events_url":"https://api.github.com/repos/brandly/gogurl/events","assignees_url":"https://api.github.com/repos/brandly/gogurl/assignees{/user}","branches_url":"https://api.github.com/repos/brandly/gogurl/branches{/branch}","tags_url":"https://api.github.com/repos/brandly/gogurl/tags","blobs_url":"https://api.github.com/repos/brandly/gogurl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brandly/gogurl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brandly/gogurl/git/refs{/sha}","trees_url":"https://api.github.com/repos/brandly/gogurl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brandly/gogurl/statuses/{sha}","languages_url":"https://api.github.com/repos/brandly/gogurl/languages","stargazers_url":"https://api.github.com/repos/brandly/gogurl/stargazers","contributors_url":"https://api.github.com/repos/brandly/gogurl/contributors","subscribers_url":"https://api.github.com/repos/brandly/gogurl/subscribers","subscription_url":"https://api.github.com/repos/brandly/gogurl/subscription","commits_url":"https://api.github.com/repos/brandly/gogurl/commits{/sha}","git_commits_url":"https://api.github.com/repos/brandly/gogurl/git/commits{/sha}","comments_url":"https://api.github.com/repos/brandly/gogurl/comments{/number}","issue_comment_url":"https://api.github.com/repos/brandly/gogurl/issues/comments{/number}","contents_url":"https://api.github.com/repos/brandly/gogurl/contents/{+path}","compare_url":"https://api.github.com/repos/brandly/gogurl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brandly/gogurl/merges","archive_url":"https://api.github.com/repos/brandly/gogurl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brandly/gogurl/downloads","issues_url":"https://api.github.com/repos/brandly/gogurl/issues{/number}","pulls_url":"https://api.github.com/repos/brandly/gogurl/pulls{/number}","milestones_url":"https://api.github.com/repos/brandly/gogurl/milestones{/number}","notifications_url":"https://api.github.com/repos/brandly/gogurl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brandly/gogurl/labels{/name}","releases_url":"https://api.github.com/repos/brandly/gogurl/releases{/id}","deployments_url":"https://api.github.com/repos/brandly/gogurl/deployments","created_at":"2018-03-01T23:08:55Z","updated_at":"2018-03-17T17:27:47Z","pushed_at":"2018-03-17T18:23:16Z","git_url":"git://github.com/brandly/gogurl.git","ssh_url":"git@github.com:brandly/gogurl.git","clone_url":"https://github.com/brandly/gogurl.git","svn_url":"https://github.com/brandly/gogurl","homepage":"","size":173,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jayed:master","ref":"master","sha":"987b0080a7cba016dac46abfc92c08e8051d59a8","user":{"login":"jayed","id":9083,"avatar_url":"https://avatars3.githubusercontent.com/u/9083?v=4","gravatar_id":"","url":"https://api.github.com/users/jayed","html_url":"https://github.com/jayed","followers_url":"https://api.github.com/users/jayed/followers","following_url":"https://api.github.com/users/jayed/following{/other_user}","gists_url":"https://api.github.com/users/jayed/gists{/gist_id}","starred_url":"https://api.github.com/users/jayed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayed/subscriptions","organizations_url":"https://api.github.com/users/jayed/orgs","repos_url":"https://api.github.com/users/jayed/repos","events_url":"https://api.github.com/users/jayed/events{/privacy}","received_events_url":"https://api.github.com/users/jayed/received_events","type":"User","site_admin":false},"repo":{"id":122532139,"name":"gogurl","full_name":"jayed/gogurl","owner":{"login":"jayed","id":9083,"avatar_url":"https://avatars3.githubusercontent.com/u/9083?v=4","gravatar_id":"","url":"https://api.github.com/users/jayed","html_url":"https://github.com/jayed","followers_url":"https://api.github.com/users/jayed/followers","following_url":"https://api.github.com/users/jayed/following{/other_user}","gists_url":"https://api.github.com/users/jayed/gists{/gist_id}","starred_url":"https://api.github.com/users/jayed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayed/subscriptions","organizations_url":"https://api.github.com/users/jayed/orgs","repos_url":"https://api.github.com/users/jayed/repos","events_url":"https://api.github.com/users/jayed/events{/privacy}","received_events_url":"https://api.github.com/users/jayed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jayed/gogurl","description":"gogurl remembers nicknames for URLs and redirects you to the actual URL","fork":false,"url":"https://api.github.com/repos/jayed/gogurl","forks_url":"https://api.github.com/repos/jayed/gogurl/forks","keys_url":"https://api.github.com/repos/jayed/gogurl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jayed/gogurl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jayed/gogurl/teams","hooks_url":"https://api.github.com/repos/jayed/gogurl/hooks","issue_events_url":"https://api.github.com/repos/jayed/gogurl/issues/events{/number}","events_url":"https://api.github.com/repos/jayed/gogurl/events","assignees_url":"https://api.github.com/repos/jayed/gogurl/assignees{/user}","branches_url":"https://api.github.com/repos/jayed/gogurl/branches{/branch}","tags_url":"https://api.github.com/repos/jayed/gogurl/tags","blobs_url":"https://api.github.com/repos/jayed/gogurl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jayed/gogurl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jayed/gogurl/git/refs{/sha}","trees_url":"https://api.github.com/repos/jayed/gogurl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jayed/gogurl/statuses/{sha}","languages_url":"https://api.github.com/repos/jayed/gogurl/languages","stargazers_url":"https://api.github.com/repos/jayed/gogurl/stargazers","contributors_url":"https://api.github.com/repos/jayed/gogurl/contributors","subscribers_url":"https://api.github.com/repos/jayed/gogurl/subscribers","subscription_url":"https://api.github.com/repos/jayed/gogurl/subscription","commits_url":"https://api.github.com/repos/jayed/gogurl/commits{/sha}","git_commits_url":"https://api.github.com/repos/jayed/gogurl/git/commits{/sha}","comments_url":"https://api.github.com/repos/jayed/gogurl/comments{/number}","issue_comment_url":"https://api.github.com/repos/jayed/gogurl/issues/comments{/number}","contents_url":"https://api.github.com/repos/jayed/gogurl/contents/{+path}","compare_url":"https://api.github.com/repos/jayed/gogurl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jayed/gogurl/merges","archive_url":"https://api.github.com/repos/jayed/gogurl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jayed/gogurl/downloads","issues_url":"https://api.github.com/repos/jayed/gogurl/issues{/number}","pulls_url":"https://api.github.com/repos/jayed/gogurl/pulls{/number}","milestones_url":"https://api.github.com/repos/jayed/gogurl/milestones{/number}","notifications_url":"https://api.github.com/repos/jayed/gogurl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jayed/gogurl/labels{/name}","releases_url":"https://api.github.com/repos/jayed/gogurl/releases{/id}","deployments_url":"https://api.github.com/repos/jayed/gogurl/deployments","created_at":"2018-02-22T20:35:02Z","updated_at":"2018-03-14T16:18:14Z","pushed_at":"2018-03-14T16:18:13Z","git_url":"git://github.com/jayed/gogurl.git","ssh_url":"git@github.com:jayed/gogurl.git","clone_url":"https://github.com/jayed/gogurl.git","svn_url":"https://github.com/jayed/gogurl","homepage":"","size":178,"stargazers_count":3,"watchers_count":3,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":3,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jayed/gogurl/pulls/9"},"html":{"href":"https://github.com/jayed/gogurl/pull/9"},"issue":{"href":"https://api.github.com/repos/jayed/gogurl/issues/9"},"comments":{"href":"https://api.github.com/repos/jayed/gogurl/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/jayed/gogurl/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/jayed/gogurl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jayed/gogurl/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/jayed/gogurl/statuses/69d634d8b336794623d58331ae1028c38d062779"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":1,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"brandly"}}