{"action":"created","comment":{"url":"https://api.github.com/repos/dustin/go-coap/pulls/comments/51215918","id":51215918,"diff_hunk":"@@ -404,6 +404,42 @@ func (m *Message) SetPath(s []string) {\n \tm.SetOption(URIPath, s)\n }\n \n+// Query gets the URI-Query option set on this message if any.\n+func (m Message) Query() []string {\n+\treturn m.optionStrings(URIQuery)\n+}\n+\n+func (m Message) QueryParamValue(name string, separator string) (string, error) {\n+\tprefix := name + separator\n+\tfor _, each := range m.Query() {\n+\t\tif strings.HasPrefix(each, prefix) {\n+\t\t\treturn each[len(prefix):], nil\n+\t\t\tbreak\n+\t\t}\n+\t}\n+\treturn \"\", errors.New(name + \": parameter is not found\")\n+}\n+\n+// QueryString assembles query options by joining with ampresand.\n+// Question mark is not pre-pended.\n+func (m Message) QueryString() string {\n+\treturn strings.Join(m.Query(), \"&\")\n+}\n+\n+// SetQueryString sets a query by a & separated string.\n+// If query string starts with '?' character, '?' is ignored.\n+func (m *Message) SetQueryString(s string) {\n+\tfor s[0] == '?' {\n+\t\ts = s[1:]\n+\t}\n+\tm.SetQuery(strings.Split(s, \"&\"))\n+}\n+\n+// SetPath updates or adds a URIPath attribute on this message.\n+func (m *Message) SetQuery(s []string) {","path":"message.go","position":36,"original_position":36,"commit_id":"753e896c63db90962d28091d8081f09a5335e7ad","original_commit_id":"753e896c63db90962d28091d8081f09a5335e7ad","user":{"login":"dubek","id":9211,"avatar_url":"https://avatars.githubusercontent.com/u/9211?v=3","gravatar_id":"","url":"https://api.github.com/users/dubek","html_url":"https://github.com/dubek","followers_url":"https://api.github.com/users/dubek/followers","following_url":"https://api.github.com/users/dubek/following{/other_user}","gists_url":"https://api.github.com/users/dubek/gists{/gist_id}","starred_url":"https://api.github.com/users/dubek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dubek/subscriptions","organizations_url":"https://api.github.com/users/dubek/orgs","repos_url":"https://api.github.com/users/dubek/repos","events_url":"https://api.github.com/users/dubek/events{/privacy}","received_events_url":"https://api.github.com/users/dubek/received_events","type":"User","site_admin":false},"body":"I'd rename `s` here to something like `queryParams`.","created_at":"2016-01-29T01:38:08Z","updated_at":"2016-01-29T01:38:08Z","html_url":"https://github.com/dustin/go-coap/pull/33#discussion_r51215918","pull_request_url":"https://api.github.com/repos/dustin/go-coap/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/comments/51215918"},"html":{"href":"https://github.com/dustin/go-coap/pull/33#discussion_r51215918"},"pull_request":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/dustin/go-coap/pulls/33","id":57536708,"html_url":"https://github.com/dustin/go-coap/pull/33","diff_url":"https://github.com/dustin/go-coap/pull/33.diff","patch_url":"https://github.com/dustin/go-coap/pull/33.patch","issue_url":"https://api.github.com/repos/dustin/go-coap/issues/33","number":33,"state":"open","locked":false,"title":"Added functions for working with URI Query","user":{"login":"Kulak","id":853478,"avatar_url":"https://avatars.githubusercontent.com/u/853478?v=3","gravatar_id":"","url":"https://api.github.com/users/Kulak","html_url":"https://github.com/Kulak","followers_url":"https://api.github.com/users/Kulak/followers","following_url":"https://api.github.com/users/Kulak/following{/other_user}","gists_url":"https://api.github.com/users/Kulak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kulak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kulak/subscriptions","organizations_url":"https://api.github.com/users/Kulak/orgs","repos_url":"https://api.github.com/users/Kulak/repos","events_url":"https://api.github.com/users/Kulak/events{/privacy}","received_events_url":"https://api.github.com/users/Kulak/received_events","type":"User","site_admin":false},"body":"This is mostly following pattern established in URIPath. It is a helper level code, but it results in easier to work with code at caller level.\r\n\r\n","created_at":"2016-01-28T17:34:11Z","updated_at":"2016-01-29T01:38:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6104ede43da653dd2d8428a4aa106b2869ff4fad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dustin/go-coap/pulls/33/commits","review_comments_url":"https://api.github.com/repos/dustin/go-coap/pulls/33/comments","review_comment_url":"https://api.github.com/repos/dustin/go-coap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dustin/go-coap/issues/33/comments","statuses_url":"https://api.github.com/repos/dustin/go-coap/statuses/753e896c63db90962d28091d8081f09a5335e7ad","head":{"label":"Kulak:master","ref":"master","sha":"753e896c63db90962d28091d8081f09a5335e7ad","user":{"login":"Kulak","id":853478,"avatar_url":"https://avatars.githubusercontent.com/u/853478?v=3","gravatar_id":"","url":"https://api.github.com/users/Kulak","html_url":"https://github.com/Kulak","followers_url":"https://api.github.com/users/Kulak/followers","following_url":"https://api.github.com/users/Kulak/following{/other_user}","gists_url":"https://api.github.com/users/Kulak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kulak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kulak/subscriptions","organizations_url":"https://api.github.com/users/Kulak/orgs","repos_url":"https://api.github.com/users/Kulak/repos","events_url":"https://api.github.com/users/Kulak/events{/privacy}","received_events_url":"https://api.github.com/users/Kulak/received_events","type":"User","site_admin":false},"repo":{"id":50139831,"name":"go-coap","full_name":"Kulak/go-coap","owner":{"login":"Kulak","id":853478,"avatar_url":"https://avatars.githubusercontent.com/u/853478?v=3","gravatar_id":"","url":"https://api.github.com/users/Kulak","html_url":"https://github.com/Kulak","followers_url":"https://api.github.com/users/Kulak/followers","following_url":"https://api.github.com/users/Kulak/following{/other_user}","gists_url":"https://api.github.com/users/Kulak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kulak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kulak/subscriptions","organizations_url":"https://api.github.com/users/Kulak/orgs","repos_url":"https://api.github.com/users/Kulak/repos","events_url":"https://api.github.com/users/Kulak/events{/privacy}","received_events_url":"https://api.github.com/users/Kulak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kulak/go-coap","description":"Implementation of CoAP in go.","fork":true,"url":"https://api.github.com/repos/Kulak/go-coap","forks_url":"https://api.github.com/repos/Kulak/go-coap/forks","keys_url":"https://api.github.com/repos/Kulak/go-coap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kulak/go-coap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kulak/go-coap/teams","hooks_url":"https://api.github.com/repos/Kulak/go-coap/hooks","issue_events_url":"https://api.github.com/repos/Kulak/go-coap/issues/events{/number}","events_url":"https://api.github.com/repos/Kulak/go-coap/events","assignees_url":"https://api.github.com/repos/Kulak/go-coap/assignees{/user}","branches_url":"https://api.github.com/repos/Kulak/go-coap/branches{/branch}","tags_url":"https://api.github.com/repos/Kulak/go-coap/tags","blobs_url":"https://api.github.com/repos/Kulak/go-coap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kulak/go-coap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kulak/go-coap/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kulak/go-coap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kulak/go-coap/statuses/{sha}","languages_url":"https://api.github.com/repos/Kulak/go-coap/languages","stargazers_url":"https://api.github.com/repos/Kulak/go-coap/stargazers","contributors_url":"https://api.github.com/repos/Kulak/go-coap/contributors","subscribers_url":"https://api.github.com/repos/Kulak/go-coap/subscribers","subscription_url":"https://api.github.com/repos/Kulak/go-coap/subscription","commits_url":"https://api.github.com/repos/Kulak/go-coap/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kulak/go-coap/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kulak/go-coap/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kulak/go-coap/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kulak/go-coap/contents/{+path}","compare_url":"https://api.github.com/repos/Kulak/go-coap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kulak/go-coap/merges","archive_url":"https://api.github.com/repos/Kulak/go-coap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kulak/go-coap/downloads","issues_url":"https://api.github.com/repos/Kulak/go-coap/issues{/number}","pulls_url":"https://api.github.com/repos/Kulak/go-coap/pulls{/number}","milestones_url":"https://api.github.com/repos/Kulak/go-coap/milestones{/number}","notifications_url":"https://api.github.com/repos/Kulak/go-coap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kulak/go-coap/labels{/name}","releases_url":"https://api.github.com/repos/Kulak/go-coap/releases{/id}","deployments_url":"https://api.github.com/repos/Kulak/go-coap/deployments","created_at":"2016-01-21T22:04:09Z","updated_at":"2016-01-21T22:04:10Z","pushed_at":"2016-01-21T23:34:41Z","git_url":"git://github.com/Kulak/go-coap.git","ssh_url":"git@github.com:Kulak/go-coap.git","clone_url":"https://github.com/Kulak/go-coap.git","svn_url":"https://github.com/Kulak/go-coap","homepage":null,"size":90,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dustin:master","ref":"master","sha":"75229d0ed26e3f08048d9220408dff03ef604f75","user":{"login":"dustin","id":1779,"avatar_url":"https://avatars.githubusercontent.com/u/1779?v=3","gravatar_id":"","url":"https://api.github.com/users/dustin","html_url":"https://github.com/dustin","followers_url":"https://api.github.com/users/dustin/followers","following_url":"https://api.github.com/users/dustin/following{/other_user}","gists_url":"https://api.github.com/users/dustin/gists{/gist_id}","starred_url":"https://api.github.com/users/dustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dustin/subscriptions","organizations_url":"https://api.github.com/users/dustin/orgs","repos_url":"https://api.github.com/users/dustin/repos","events_url":"https://api.github.com/users/dustin/events{/privacy}","received_events_url":"https://api.github.com/users/dustin/received_events","type":"User","site_admin":false},"repo":{"id":4848089,"name":"go-coap","full_name":"dustin/go-coap","owner":{"login":"dustin","id":1779,"avatar_url":"https://avatars.githubusercontent.com/u/1779?v=3","gravatar_id":"","url":"https://api.github.com/users/dustin","html_url":"https://github.com/dustin","followers_url":"https://api.github.com/users/dustin/followers","following_url":"https://api.github.com/users/dustin/following{/other_user}","gists_url":"https://api.github.com/users/dustin/gists{/gist_id}","starred_url":"https://api.github.com/users/dustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dustin/subscriptions","organizations_url":"https://api.github.com/users/dustin/orgs","repos_url":"https://api.github.com/users/dustin/repos","events_url":"https://api.github.com/users/dustin/events{/privacy}","received_events_url":"https://api.github.com/users/dustin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dustin/go-coap","description":"Implementation of CoAP in go.","fork":false,"url":"https://api.github.com/repos/dustin/go-coap","forks_url":"https://api.github.com/repos/dustin/go-coap/forks","keys_url":"https://api.github.com/repos/dustin/go-coap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dustin/go-coap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dustin/go-coap/teams","hooks_url":"https://api.github.com/repos/dustin/go-coap/hooks","issue_events_url":"https://api.github.com/repos/dustin/go-coap/issues/events{/number}","events_url":"https://api.github.com/repos/dustin/go-coap/events","assignees_url":"https://api.github.com/repos/dustin/go-coap/assignees{/user}","branches_url":"https://api.github.com/repos/dustin/go-coap/branches{/branch}","tags_url":"https://api.github.com/repos/dustin/go-coap/tags","blobs_url":"https://api.github.com/repos/dustin/go-coap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dustin/go-coap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dustin/go-coap/git/refs{/sha}","trees_url":"https://api.github.com/repos/dustin/go-coap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dustin/go-coap/statuses/{sha}","languages_url":"https://api.github.com/repos/dustin/go-coap/languages","stargazers_url":"https://api.github.com/repos/dustin/go-coap/stargazers","contributors_url":"https://api.github.com/repos/dustin/go-coap/contributors","subscribers_url":"https://api.github.com/repos/dustin/go-coap/subscribers","subscription_url":"https://api.github.com/repos/dustin/go-coap/subscription","commits_url":"https://api.github.com/repos/dustin/go-coap/commits{/sha}","git_commits_url":"https://api.github.com/repos/dustin/go-coap/git/commits{/sha}","comments_url":"https://api.github.com/repos/dustin/go-coap/comments{/number}","issue_comment_url":"https://api.github.com/repos/dustin/go-coap/issues/comments{/number}","contents_url":"https://api.github.com/repos/dustin/go-coap/contents/{+path}","compare_url":"https://api.github.com/repos/dustin/go-coap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dustin/go-coap/merges","archive_url":"https://api.github.com/repos/dustin/go-coap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dustin/go-coap/downloads","issues_url":"https://api.github.com/repos/dustin/go-coap/issues{/number}","pulls_url":"https://api.github.com/repos/dustin/go-coap/pulls{/number}","milestones_url":"https://api.github.com/repos/dustin/go-coap/milestones{/number}","notifications_url":"https://api.github.com/repos/dustin/go-coap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dustin/go-coap/labels{/name}","releases_url":"https://api.github.com/repos/dustin/go-coap/releases{/id}","deployments_url":"https://api.github.com/repos/dustin/go-coap/deployments","created_at":"2012-07-01T05:15:37Z","updated_at":"2016-01-28T12:50:57Z","pushed_at":"2016-01-28T17:34:14Z","git_url":"git://github.com/dustin/go-coap.git","ssh_url":"git@github.com:dustin/go-coap.git","clone_url":"https://github.com/dustin/go-coap.git","svn_url":"https://github.com/dustin/go-coap","homepage":null,"size":112,"stargazers_count":100,"watchers_count":100,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":10,"forks":27,"open_issues":10,"watchers":100,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/33"},"html":{"href":"https://github.com/dustin/go-coap/pull/33"},"issue":{"href":"https://api.github.com/repos/dustin/go-coap/issues/33"},"comments":{"href":"https://api.github.com/repos/dustin/go-coap/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dustin/go-coap/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/dustin/go-coap/statuses/753e896c63db90962d28091d8081f09a5335e7ad"}}}}