{"action":"created","comment":{"url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/comments/265770729","pull_request_review_id":214768096,"id":265770729,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2NTc3MDcyOQ==","diff_hunk":"@@ -214,9 +214,23 @@ impl Status {\n         header_map.insert(GRPC_STATUS_HEADER_CODE, self.code.to_header_value());\n \n         if !self.message.is_empty() {\n-            header_map.insert(GRPC_STATUS_MESSAGE_HEADER, HeaderValue::from_str(&self.message)\n-                .map_err(invalid_header_value_byte)?);\n+            let good_bytes = &self.message.as_bytes().iter().all(|&x| DEFAULT_ENCODE_SET.contains(x));\n+            let to_write = \n+            match good_bytes{\n+                true => {\n+                    Bytes::from(\n+                        percent_encode(&self.message().as_bytes(), DEFAULT_ENCODE_SET)\n+                        .to_string()\n+                        .as_bytes())","path":"src/status.rs","position":22,"original_position":22,"commit_id":"3311e0579c730bb6c45afce3dedee2bb5f5fa2d2","original_commit_id":"3311e0579c730bb6c45afce3dedee2bb5f5fa2d2","user":{"login":"seanmonstar","id":51479,"node_id":"MDQ6VXNlcjUxNDc5","avatar_url":"https://avatars1.githubusercontent.com/u/51479?v=4","gravatar_id":"","url":"https://api.github.com/users/seanmonstar","html_url":"https://github.com/seanmonstar","followers_url":"https://api.github.com/users/seanmonstar/followers","following_url":"https://api.github.com/users/seanmonstar/following{/other_user}","gists_url":"https://api.github.com/users/seanmonstar/gists{/gist_id}","starred_url":"https://api.github.com/users/seanmonstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanmonstar/subscriptions","organizations_url":"https://api.github.com/users/seanmonstar/orgs","repos_url":"https://api.github.com/users/seanmonstar/repos","events_url":"https://api.github.com/users/seanmonstar/events{/privacy}","received_events_url":"https://api.github.com/users/seanmonstar/received_events","type":"User","site_admin":false},"body":"This is a slight gotcha: when percent-encoding, we have a new `String` (from `to_string()`), which owns some memory. It's nearly free to convert a `String` into a `Bytes`, as it just assumes ownership of that memory. By calling `Bytes::from(String.as_bytes())`, this is asking `Bytes` to create a new slot of memory and copy, since `as_bytes` returns a borrow of the `String`s memory.\r\n\r\nSo, this could just be `percent_encode(..).to_string().into()` (type inference will detect what `into` will convert to because the other branch is also returning `Bytes`.","created_at":"2019-03-14T21:20:03Z","updated_at":"2019-03-14T21:20:39Z","html_url":"https://github.com/tower-rs/tower-grpc/pull/135#discussion_r265770729","pull_request_url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/comments/265770729"},"html":{"href":"https://github.com/tower-rs/tower-grpc/pull/135#discussion_r265770729"},"pull_request":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135","id":259644803,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU5NjQ0ODAz","html_url":"https://github.com/tower-rs/tower-grpc/pull/135","diff_url":"https://github.com/tower-rs/tower-grpc/pull/135.diff","patch_url":"https://github.com/tower-rs/tower-grpc/pull/135.patch","issue_url":"https://api.github.com/repos/tower-rs/tower-grpc/issues/135","number":135,"state":"open","locked":false,"title":"to allow encoding of Status including utf-8 char","user":{"login":"Emanon42","id":21653733,"node_id":"MDQ6VXNlcjIxNjUzNzMz","avatar_url":"https://avatars0.githubusercontent.com/u/21653733?v=4","gravatar_id":"","url":"https://api.github.com/users/Emanon42","html_url":"https://github.com/Emanon42","followers_url":"https://api.github.com/users/Emanon42/followers","following_url":"https://api.github.com/users/Emanon42/following{/other_user}","gists_url":"https://api.github.com/users/Emanon42/gists{/gist_id}","starred_url":"https://api.github.com/users/Emanon42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Emanon42/subscriptions","organizations_url":"https://api.github.com/users/Emanon42/orgs","repos_url":"https://api.github.com/users/Emanon42/repos","events_url":"https://api.github.com/users/Emanon42/events{/privacy}","received_events_url":"https://api.github.com/users/Emanon42/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-03-09T00:10:01Z","updated_at":"2019-03-14T21:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97ba77f7c36eff524a49a61f0a10d43cd328860d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135/commits","review_comments_url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135/comments","review_comment_url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tower-rs/tower-grpc/issues/135/comments","statuses_url":"https://api.github.com/repos/tower-rs/tower-grpc/statuses/3311e0579c730bb6c45afce3dedee2bb5f5fa2d2","head":{"label":"Emanon42:master","ref":"master","sha":"3311e0579c730bb6c45afce3dedee2bb5f5fa2d2","user":{"login":"Emanon42","id":21653733,"node_id":"MDQ6VXNlcjIxNjUzNzMz","avatar_url":"https://avatars0.githubusercontent.com/u/21653733?v=4","gravatar_id":"","url":"https://api.github.com/users/Emanon42","html_url":"https://github.com/Emanon42","followers_url":"https://api.github.com/users/Emanon42/followers","following_url":"https://api.github.com/users/Emanon42/following{/other_user}","gists_url":"https://api.github.com/users/Emanon42/gists{/gist_id}","starred_url":"https://api.github.com/users/Emanon42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Emanon42/subscriptions","organizations_url":"https://api.github.com/users/Emanon42/orgs","repos_url":"https://api.github.com/users/Emanon42/repos","events_url":"https://api.github.com/users/Emanon42/events{/privacy}","received_events_url":"https://api.github.com/users/Emanon42/received_events","type":"User","site_admin":false},"repo":{"id":174628036,"node_id":"MDEwOlJlcG9zaXRvcnkxNzQ2MjgwMzY=","name":"tower-grpc","full_name":"Emanon42/tower-grpc","private":false,"owner":{"login":"Emanon42","id":21653733,"node_id":"MDQ6VXNlcjIxNjUzNzMz","avatar_url":"https://avatars0.githubusercontent.com/u/21653733?v=4","gravatar_id":"","url":"https://api.github.com/users/Emanon42","html_url":"https://github.com/Emanon42","followers_url":"https://api.github.com/users/Emanon42/followers","following_url":"https://api.github.com/users/Emanon42/following{/other_user}","gists_url":"https://api.github.com/users/Emanon42/gists{/gist_id}","starred_url":"https://api.github.com/users/Emanon42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Emanon42/subscriptions","organizations_url":"https://api.github.com/users/Emanon42/orgs","repos_url":"https://api.github.com/users/Emanon42/repos","events_url":"https://api.github.com/users/Emanon42/events{/privacy}","received_events_url":"https://api.github.com/users/Emanon42/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Emanon42/tower-grpc","description":"A gRPC client & server implementation.","fork":true,"url":"https://api.github.com/repos/Emanon42/tower-grpc","forks_url":"https://api.github.com/repos/Emanon42/tower-grpc/forks","keys_url":"https://api.github.com/repos/Emanon42/tower-grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Emanon42/tower-grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Emanon42/tower-grpc/teams","hooks_url":"https://api.github.com/repos/Emanon42/tower-grpc/hooks","issue_events_url":"https://api.github.com/repos/Emanon42/tower-grpc/issues/events{/number}","events_url":"https://api.github.com/repos/Emanon42/tower-grpc/events","assignees_url":"https://api.github.com/repos/Emanon42/tower-grpc/assignees{/user}","branches_url":"https://api.github.com/repos/Emanon42/tower-grpc/branches{/branch}","tags_url":"https://api.github.com/repos/Emanon42/tower-grpc/tags","blobs_url":"https://api.github.com/repos/Emanon42/tower-grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Emanon42/tower-grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Emanon42/tower-grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/Emanon42/tower-grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Emanon42/tower-grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/Emanon42/tower-grpc/languages","stargazers_url":"https://api.github.com/repos/Emanon42/tower-grpc/stargazers","contributors_url":"https://api.github.com/repos/Emanon42/tower-grpc/contributors","subscribers_url":"https://api.github.com/repos/Emanon42/tower-grpc/subscribers","subscription_url":"https://api.github.com/repos/Emanon42/tower-grpc/subscription","commits_url":"https://api.github.com/repos/Emanon42/tower-grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/Emanon42/tower-grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/Emanon42/tower-grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/Emanon42/tower-grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/Emanon42/tower-grpc/contents/{+path}","compare_url":"https://api.github.com/repos/Emanon42/tower-grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Emanon42/tower-grpc/merges","archive_url":"https://api.github.com/repos/Emanon42/tower-grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Emanon42/tower-grpc/downloads","issues_url":"https://api.github.com/repos/Emanon42/tower-grpc/issues{/number}","pulls_url":"https://api.github.com/repos/Emanon42/tower-grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/Emanon42/tower-grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/Emanon42/tower-grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Emanon42/tower-grpc/labels{/name}","releases_url":"https://api.github.com/repos/Emanon42/tower-grpc/releases{/id}","deployments_url":"https://api.github.com/repos/Emanon42/tower-grpc/deployments","created_at":"2019-03-09T00:07:12Z","updated_at":"2019-03-14T20:15:37Z","pushed_at":"2019-03-14T20:15:35Z","git_url":"git://github.com/Emanon42/tower-grpc.git","ssh_url":"git@github.com:Emanon42/tower-grpc.git","clone_url":"https://github.com/Emanon42/tower-grpc.git","svn_url":"https://github.com/Emanon42/tower-grpc","homepage":null,"size":1479,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tower-rs:master","ref":"master","sha":"29227a45506e8a3a7f216ed67f5ad912d9368d9e","user":{"login":"tower-rs","id":26263939,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MjYzOTM5","avatar_url":"https://avatars0.githubusercontent.com/u/26263939?v=4","gravatar_id":"","url":"https://api.github.com/users/tower-rs","html_url":"https://github.com/tower-rs","followers_url":"https://api.github.com/users/tower-rs/followers","following_url":"https://api.github.com/users/tower-rs/following{/other_user}","gists_url":"https://api.github.com/users/tower-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tower-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tower-rs/subscriptions","organizations_url":"https://api.github.com/users/tower-rs/orgs","repos_url":"https://api.github.com/users/tower-rs/repos","events_url":"https://api.github.com/users/tower-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tower-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":113232134,"node_id":"MDEwOlJlcG9zaXRvcnkxMTMyMzIxMzQ=","name":"tower-grpc","full_name":"tower-rs/tower-grpc","private":false,"owner":{"login":"tower-rs","id":26263939,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MjYzOTM5","avatar_url":"https://avatars0.githubusercontent.com/u/26263939?v=4","gravatar_id":"","url":"https://api.github.com/users/tower-rs","html_url":"https://github.com/tower-rs","followers_url":"https://api.github.com/users/tower-rs/followers","following_url":"https://api.github.com/users/tower-rs/following{/other_user}","gists_url":"https://api.github.com/users/tower-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tower-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tower-rs/subscriptions","organizations_url":"https://api.github.com/users/tower-rs/orgs","repos_url":"https://api.github.com/users/tower-rs/repos","events_url":"https://api.github.com/users/tower-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tower-rs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tower-rs/tower-grpc","description":"A gRPC client & server implementation.","fork":false,"url":"https://api.github.com/repos/tower-rs/tower-grpc","forks_url":"https://api.github.com/repos/tower-rs/tower-grpc/forks","keys_url":"https://api.github.com/repos/tower-rs/tower-grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tower-rs/tower-grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tower-rs/tower-grpc/teams","hooks_url":"https://api.github.com/repos/tower-rs/tower-grpc/hooks","issue_events_url":"https://api.github.com/repos/tower-rs/tower-grpc/issues/events{/number}","events_url":"https://api.github.com/repos/tower-rs/tower-grpc/events","assignees_url":"https://api.github.com/repos/tower-rs/tower-grpc/assignees{/user}","branches_url":"https://api.github.com/repos/tower-rs/tower-grpc/branches{/branch}","tags_url":"https://api.github.com/repos/tower-rs/tower-grpc/tags","blobs_url":"https://api.github.com/repos/tower-rs/tower-grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tower-rs/tower-grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tower-rs/tower-grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/tower-rs/tower-grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tower-rs/tower-grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/tower-rs/tower-grpc/languages","stargazers_url":"https://api.github.com/repos/tower-rs/tower-grpc/stargazers","contributors_url":"https://api.github.com/repos/tower-rs/tower-grpc/contributors","subscribers_url":"https://api.github.com/repos/tower-rs/tower-grpc/subscribers","subscription_url":"https://api.github.com/repos/tower-rs/tower-grpc/subscription","commits_url":"https://api.github.com/repos/tower-rs/tower-grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/tower-rs/tower-grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/tower-rs/tower-grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/tower-rs/tower-grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/tower-rs/tower-grpc/contents/{+path}","compare_url":"https://api.github.com/repos/tower-rs/tower-grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tower-rs/tower-grpc/merges","archive_url":"https://api.github.com/repos/tower-rs/tower-grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tower-rs/tower-grpc/downloads","issues_url":"https://api.github.com/repos/tower-rs/tower-grpc/issues{/number}","pulls_url":"https://api.github.com/repos/tower-rs/tower-grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/tower-rs/tower-grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/tower-rs/tower-grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tower-rs/tower-grpc/labels{/name}","releases_url":"https://api.github.com/repos/tower-rs/tower-grpc/releases{/id}","deployments_url":"https://api.github.com/repos/tower-rs/tower-grpc/deployments","created_at":"2017-12-05T20:56:56Z","updated_at":"2019-03-14T20:17:20Z","pushed_at":"2019-03-14T20:19:02Z","git_url":"git://github.com/tower-rs/tower-grpc.git","ssh_url":"git@github.com:tower-rs/tower-grpc.git","clone_url":"https://github.com/tower-rs/tower-grpc.git","svn_url":"https://github.com/tower-rs/tower-grpc","homepage":null,"size":1461,"stargazers_count":310,"watchers_count":310,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":37,"mirror_url":null,"archived":false,"open_issues_count":26,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":37,"open_issues":26,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135"},"html":{"href":"https://github.com/tower-rs/tower-grpc/pull/135"},"issue":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/issues/135"},"comments":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/tower-rs/tower-grpc/statuses/3311e0579c730bb6c45afce3dedee2bb5f5fa2d2"}},"author_association":"NONE"}}
{"actor":{"display_login":"seanmonstar"}}