{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/skipper/pulls/comments/40927387","id":40927387,"diff_hunk":"@@ -0,0 +1,601 @@\n+package innkeeper\n+\n+import (\n+\t\"encoding/json\"\n+\t\"errors\"\n+\t\"github.com/zalando/eskip\"\n+\t\"github.com/zalando/skipper/skipper\"\n+\t\"net/http\"\n+\t\"net/http/httptest\"\n+\t\"path\"\n+\t\"sort\"\n+\t\"strings\"\n+\t\"testing\"\n+\t\"time\"\n+)\n+\n+const testAuthenticationToken = \"test token\"\n+\n+type autoAuth bool\n+\n+func (aa autoAuth) Token() (string, error) {\n+\tif aa {\n+\t\treturn testAuthenticationToken, nil\n+\t}\n+\n+\treturn \"\", errors.New(string(authErrorAuthentication))\n+}\n+\n+type innkeeperHandler struct{ data []*routeData }\n+\n+func (h *innkeeperHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n+\tif r.Header.Get(authHeaderName) != testAuthenticationToken {\n+\t\tw.WriteHeader(http.StatusUnauthorized)\n+\t\tenc := json.NewEncoder(w)\n+\n+\t\t// ignoring error\n+\t\tenc.Encode(&apiError{ErrorType: string(authErrorPermission)})\n+\n+\t\treturn\n+\t}\n+\n+\tvar responseData []*routeData\n+\tif r.URL.Path == \"/routes\" {\n+\t\tfor _, di := range h.data {\n+\t\t\tif di.DeletedAt == \"\" {\n+\t\t\t\tresponseData = append(responseData, di)\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\tlm := path.Base(r.URL.Path)\n+\t\tif lm == updatePathRoot {\n+\t\t\tlm = \"\"\n+\t\t}\n+\n+\t\tresponseData = []*routeData{}\n+\t\tfor _, di := range h.data {\n+\t\t\tif di.CreatedAt > lm || di.DeletedAt > lm {\n+\t\t\t\tresponseData = append(responseData, di)\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tif b, err := json.Marshal(responseData); err == nil {\n+\t\tw.Write(b)\n+\t} else {\n+\t\tw.WriteHeader(http.StatusInternalServerError)\n+\t}\n+}\n+\n+func sortDoc(doc string) string {\n+\texps := strings.Split(doc, \";\")\n+\tfor i, exp := range exps {\n+\t\texps[i] = strings.Trim(exp, \" \\n\")\n+\t}\n+\tsort.Strings(exps)\n+\treturn strings.Join(exps, \";\")\n+}\n+\n+func checkDoc(out skipper.RawData, in []*routeData) bool {\n+\tc := &Client{doc: make(map[int64]map[string]string)}","path":"innkeeper/client_test.go","position":80,"original_position":80,"commit_id":"3cbc73b18d77993d3583a79b07a21e0b80eac1be","original_commit_id":"3cbc73b18d77993d3583a79b07a21e0b80eac1be","user":{"login":"aryszka","id":733217,"avatar_url":"https://avatars.githubusercontent.com/u/733217?v=3","gravatar_id":"","url":"https://api.github.com/users/aryszka","html_url":"https://github.com/aryszka","followers_url":"https://api.github.com/users/aryszka/followers","following_url":"https://api.github.com/users/aryszka/following{/other_user}","gists_url":"https://api.github.com/users/aryszka/gists{/gist_id}","starred_url":"https://api.github.com/users/aryszka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aryszka/subscriptions","organizations_url":"https://api.github.com/users/aryszka/orgs","repos_url":"https://api.github.com/users/aryszka/repos","events_url":"https://api.github.com/users/aryszka/events{/privacy}","received_events_url":"https://api.github.com/users/aryszka/received_events","type":"User","site_admin":false},"body":"good point","created_at":"2015-10-01T15:32:27Z","updated_at":"2015-10-01T15:32:27Z","html_url":"https://github.com/zalando/skipper/pull/7#discussion_r40927387","pull_request_url":"https://api.github.com/repos/zalando/skipper/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/zalando/skipper/pulls/comments/40927387"},"html":{"href":"https://github.com/zalando/skipper/pull/7#discussion_r40927387"},"pull_request":{"href":"https://api.github.com/repos/zalando/skipper/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/skipper/pulls/7","id":44785230,"html_url":"https://github.com/zalando/skipper/pull/7","diff_url":"https://github.com/zalando/skipper/pull/7.diff","patch_url":"https://github.com/zalando/skipper/pull/7.patch","issue_url":"https://api.github.com/repos/zalando/skipper/issues/7","number":7,"state":"open","locked":false,"title":"Innkeeper data client","user":{"login":"danpersa","id":579158,"avatar_url":"https://avatars.githubusercontent.com/u/579158?v=3","gravatar_id":"","url":"https://api.github.com/users/danpersa","html_url":"https://github.com/danpersa","followers_url":"https://api.github.com/users/danpersa/followers","following_url":"https://api.github.com/users/danpersa/following{/other_user}","gists_url":"https://api.github.com/users/danpersa/gists{/gist_id}","starred_url":"https://api.github.com/users/danpersa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danpersa/subscriptions","organizations_url":"https://api.github.com/users/danpersa/orgs","repos_url":"https://api.github.com/users/danpersa/repos","events_url":"https://api.github.com/users/danpersa/events{/privacy}","received_events_url":"https://api.github.com/users/danpersa/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-11T13:58:37Z","updated_at":"2015-10-01T15:32:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b989b8418606a6539846d5328d7e7db8287f607a","assignee":{"login":"lmineiro","id":4234681,"avatar_url":"https://avatars.githubusercontent.com/u/4234681?v=3","gravatar_id":"","url":"https://api.github.com/users/lmineiro","html_url":"https://github.com/lmineiro","followers_url":"https://api.github.com/users/lmineiro/followers","following_url":"https://api.github.com/users/lmineiro/following{/other_user}","gists_url":"https://api.github.com/users/lmineiro/gists{/gist_id}","starred_url":"https://api.github.com/users/lmineiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmineiro/subscriptions","organizations_url":"https://api.github.com/users/lmineiro/orgs","repos_url":"https://api.github.com/users/lmineiro/repos","events_url":"https://api.github.com/users/lmineiro/events{/privacy}","received_events_url":"https://api.github.com/users/lmineiro/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/zalando/skipper/pulls/7/commits","review_comments_url":"https://api.github.com/repos/zalando/skipper/pulls/7/comments","review_comment_url":"https://api.github.com/repos/zalando/skipper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/skipper/issues/7/comments","statuses_url":"https://api.github.com/repos/zalando/skipper/statuses/3cbc73b18d77993d3583a79b07a21e0b80eac1be","head":{"label":"zalando:innkeeper-data-client","ref":"innkeeper-data-client","sha":"3cbc73b18d77993d3583a79b07a21e0b80eac1be","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":38812664,"name":"skipper","full_name":"zalando/skipper","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/skipper","description":"","fork":false,"url":"https://api.github.com/repos/zalando/skipper","forks_url":"https://api.github.com/repos/zalando/skipper/forks","keys_url":"https://api.github.com/repos/zalando/skipper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/skipper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/skipper/teams","hooks_url":"https://api.github.com/repos/zalando/skipper/hooks","issue_events_url":"https://api.github.com/repos/zalando/skipper/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/skipper/events","assignees_url":"https://api.github.com/repos/zalando/skipper/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/skipper/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/skipper/tags","blobs_url":"https://api.github.com/repos/zalando/skipper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/skipper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/skipper/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/skipper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/skipper/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/skipper/languages","stargazers_url":"https://api.github.com/repos/zalando/skipper/stargazers","contributors_url":"https://api.github.com/repos/zalando/skipper/contributors","subscribers_url":"https://api.github.com/repos/zalando/skipper/subscribers","subscription_url":"https://api.github.com/repos/zalando/skipper/subscription","commits_url":"https://api.github.com/repos/zalando/skipper/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/skipper/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/skipper/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/skipper/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/skipper/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/skipper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/skipper/merges","archive_url":"https://api.github.com/repos/zalando/skipper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/skipper/downloads","issues_url":"https://api.github.com/repos/zalando/skipper/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/skipper/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/skipper/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/skipper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/skipper/labels{/name}","releases_url":"https://api.github.com/repos/zalando/skipper/releases{/id}","created_at":"2015-07-09T09:54:40Z","updated_at":"2015-08-20T03:06:11Z","pushed_at":"2015-10-01T13:39:04Z","git_url":"git://github.com/zalando/skipper.git","ssh_url":"git@github.com:zalando/skipper.git","clone_url":"https://github.com/zalando/skipper.git","svn_url":"https://github.com/zalando/skipper","homepage":null,"size":2178,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"zalando:master","ref":"master","sha":"2115cafc520bf7d2fe98b468b16dedfba1afc384","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":38812664,"name":"skipper","full_name":"zalando/skipper","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/skipper","description":"","fork":false,"url":"https://api.github.com/repos/zalando/skipper","forks_url":"https://api.github.com/repos/zalando/skipper/forks","keys_url":"https://api.github.com/repos/zalando/skipper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/skipper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/skipper/teams","hooks_url":"https://api.github.com/repos/zalando/skipper/hooks","issue_events_url":"https://api.github.com/repos/zalando/skipper/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/skipper/events","assignees_url":"https://api.github.com/repos/zalando/skipper/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/skipper/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/skipper/tags","blobs_url":"https://api.github.com/repos/zalando/skipper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/skipper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/skipper/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/skipper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/skipper/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/skipper/languages","stargazers_url":"https://api.github.com/repos/zalando/skipper/stargazers","contributors_url":"https://api.github.com/repos/zalando/skipper/contributors","subscribers_url":"https://api.github.com/repos/zalando/skipper/subscribers","subscription_url":"https://api.github.com/repos/zalando/skipper/subscription","commits_url":"https://api.github.com/repos/zalando/skipper/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/skipper/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/skipper/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/skipper/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/skipper/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/skipper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/skipper/merges","archive_url":"https://api.github.com/repos/zalando/skipper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/skipper/downloads","issues_url":"https://api.github.com/repos/zalando/skipper/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/skipper/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/skipper/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/skipper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/skipper/labels{/name}","releases_url":"https://api.github.com/repos/zalando/skipper/releases{/id}","created_at":"2015-07-09T09:54:40Z","updated_at":"2015-08-20T03:06:11Z","pushed_at":"2015-10-01T13:39:04Z","git_url":"git://github.com/zalando/skipper.git","ssh_url":"git@github.com:zalando/skipper.git","clone_url":"https://github.com/zalando/skipper.git","svn_url":"https://github.com/zalando/skipper","homepage":null,"size":2178,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/skipper/pulls/7"},"html":{"href":"https://github.com/zalando/skipper/pull/7"},"issue":{"href":"https://api.github.com/repos/zalando/skipper/issues/7"},"comments":{"href":"https://api.github.com/repos/zalando/skipper/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/skipper/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/skipper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/skipper/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/skipper/statuses/3cbc73b18d77993d3583a79b07a21e0b80eac1be"}}}}