{"action":"created","comment":{"url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/comments/39087789","id":39087789,"diff_hunk":"@@ -188,33 +230,206 @@ api.claim = function(actor, id, callback) {\n   });\n };\n \n-bedrock.events.on('bedrock-mongodb.ready', function(callback) {\n-  async.auto({\n-    createIndexes: function(callback) {\n-      // create indexes for claimed status\n-      database.createIndexes([{\n-        collection: store.provider.name,\n-        fields: {recipient: 1, 'credential.sysState': 1, id: 1},\n-        options: {unique: true, background: false}\n-      }, {\n-        collection: store.provider.name,\n-        fields: {issuer: 1, 'credential.sysState': 1, id: 1},\n-        options: {unique: true, background: false}\n-      }], callback);\n+// TODO: more acceptable formats?\n+function checkHeaders(req, res, next) {\n+  var acceptableContentTypes = [\n+    'application/json',\n+    'application/ld+json',\n+    'text/html'\n+  ];\n+  if(!req.accepts(acceptableContentTypes)) {\n+    res.status(406);\n+    res.write(JSON.stringify({\n+      message: 'Requested content types not acceptable.',\n+      details: {\n+        accepted: req.get('accept'),\n+        acceptable: acceptableContentTypes\n+      }\n+    }));\n+    res.end();\n+    return next();\n+  }\n+  if(acceptableContentTypes.indexOf(req.get('Content-Type')) == -1) {","path":"lib/issuer.js","position":108,"original_position":108,"commit_id":"fb384a3361466def4d42ef696c6bcbc89c3e3d4e","original_commit_id":"fb384a3361466def4d42ef696c6bcbc89c3e3d4e","user":{"login":"dlongley","id":168137,"avatar_url":"https://avatars.githubusercontent.com/u/168137?v=3","gravatar_id":"","url":"https://api.github.com/users/dlongley","html_url":"https://github.com/dlongley","followers_url":"https://api.github.com/users/dlongley/followers","following_url":"https://api.github.com/users/dlongley/following{/other_user}","gists_url":"https://api.github.com/users/dlongley/gists{/gist_id}","starred_url":"https://api.github.com/users/dlongley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlongley/subscriptions","organizations_url":"https://api.github.com/users/dlongley/orgs","repos_url":"https://api.github.com/users/dlongley/repos","events_url":"https://api.github.com/users/dlongley/events{/privacy}","received_events_url":"https://api.github.com/users/dlongley/received_events","type":"User","site_admin":false},"body":"Why is request 'Content-Type' (this is for the mime type of the request body) being compared to acceptable content types? Should this be using the `Accept` header instead? How is this check different (or meant to be different) from the `req.accepts` check above? Are the accept type and content type being bound together somehow here? (confusion).","created_at":"2015-09-09T19:52:29Z","updated_at":"2015-09-09T19:52:29Z","html_url":"https://github.com/digitalbazaar/bedrock-issuer/pull/1#discussion_r39087789","pull_request_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/comments/39087789"},"html":{"href":"https://github.com/digitalbazaar/bedrock-issuer/pull/1#discussion_r39087789"},"pull_request":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1","id":44458798,"html_url":"https://github.com/digitalbazaar/bedrock-issuer/pull/1","diff_url":"https://github.com/digitalbazaar/bedrock-issuer/pull/1.diff","patch_url":"https://github.com/digitalbazaar/bedrock-issuer/pull/1.patch","issue_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/1","number":1,"state":"open","locked":false,"title":"Credential xfer","user":{"login":"mattcollier","id":902041,"avatar_url":"https://avatars.githubusercontent.com/u/902041?v=3","gravatar_id":"","url":"https://api.github.com/users/mattcollier","html_url":"https://github.com/mattcollier","followers_url":"https://api.github.com/users/mattcollier/followers","following_url":"https://api.github.com/users/mattcollier/following{/other_user}","gists_url":"https://api.github.com/users/mattcollier/gists{/gist_id}","starred_url":"https://api.github.com/users/mattcollier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattcollier/subscriptions","organizations_url":"https://api.github.com/users/mattcollier/orgs","repos_url":"https://api.github.com/users/mattcollier/repos","events_url":"https://api.github.com/users/mattcollier/events{/privacy}","received_events_url":"https://api.github.com/users/mattcollier/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-08T17:17:56Z","updated_at":"2015-09-09T19:52:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9172c8a3278f0efd5ad07f5c8f2fa45f6e3c8678","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1/commits","review_comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1/comments","review_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/1/comments","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/statuses/fb384a3361466def4d42ef696c6bcbc89c3e3d4e","head":{"label":"digitalbazaar:credential-xfer","ref":"credential-xfer","sha":"fb384a3361466def4d42ef696c6bcbc89c3e3d4e","user":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":35245529,"name":"bedrock-issuer","full_name":"digitalbazaar/bedrock-issuer","owner":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digitalbazaar/bedrock-issuer","description":"No frills credential issuance","fork":false,"url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer","forks_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/forks","keys_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/events","assignees_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/merges","archive_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/releases{/id}","created_at":"2015-05-07T21:55:14Z","updated_at":"2015-05-11T15:15:08Z","pushed_at":"2015-09-08T17:17:58Z","git_url":"git://github.com/digitalbazaar/bedrock-issuer.git","ssh_url":"git@github.com:digitalbazaar/bedrock-issuer.git","clone_url":"https://github.com/digitalbazaar/bedrock-issuer.git","svn_url":"https://github.com/digitalbazaar/bedrock-issuer","homepage":null,"size":182,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"digitalbazaar:master","ref":"master","sha":"4b3db96a3a0937234b7d5538ece1c64db5916eba","user":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"repo":{"id":35245529,"name":"bedrock-issuer","full_name":"digitalbazaar/bedrock-issuer","owner":{"login":"digitalbazaar","id":167436,"avatar_url":"https://avatars.githubusercontent.com/u/167436?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalbazaar","html_url":"https://github.com/digitalbazaar","followers_url":"https://api.github.com/users/digitalbazaar/followers","following_url":"https://api.github.com/users/digitalbazaar/following{/other_user}","gists_url":"https://api.github.com/users/digitalbazaar/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalbazaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalbazaar/subscriptions","organizations_url":"https://api.github.com/users/digitalbazaar/orgs","repos_url":"https://api.github.com/users/digitalbazaar/repos","events_url":"https://api.github.com/users/digitalbazaar/events{/privacy}","received_events_url":"https://api.github.com/users/digitalbazaar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digitalbazaar/bedrock-issuer","description":"No frills credential issuance","fork":false,"url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer","forks_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/forks","keys_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/teams","hooks_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/hooks","issue_events_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/events{/number}","events_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/events","assignees_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/assignees{/user}","branches_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/branches{/branch}","tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/tags","blobs_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/languages","stargazers_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/stargazers","contributors_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/contributors","subscribers_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/subscribers","subscription_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/subscription","commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/contents/{+path}","compare_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/merges","archive_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/downloads","issues_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues{/number}","pulls_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/labels{/name}","releases_url":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/releases{/id}","created_at":"2015-05-07T21:55:14Z","updated_at":"2015-05-11T15:15:08Z","pushed_at":"2015-09-08T17:17:58Z","git_url":"git://github.com/digitalbazaar/bedrock-issuer.git","ssh_url":"git@github.com:digitalbazaar/bedrock-issuer.git","clone_url":"https://github.com/digitalbazaar/bedrock-issuer.git","svn_url":"https://github.com/digitalbazaar/bedrock-issuer","homepage":null,"size":182,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1"},"html":{"href":"https://github.com/digitalbazaar/bedrock-issuer/pull/1"},"issue":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/1"},"comments":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/digitalbazaar/bedrock-issuer/statuses/fb384a3361466def4d42ef696c6bcbc89c3e3d4e"}}}}