{"action":"opened","issue":{"url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/581","repository_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway","labels_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/581/labels{/name}","comments_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/581/comments","events_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/581/events","html_url":"https://github.com/grpc-ecosystem/grpc-gateway/issues/581","id":308015506,"number":581,"title":"Streamed response is not valid json (or: is this the expected format?)","user":{"login":"colini","id":2913561,"avatar_url":"https://avatars2.githubusercontent.com/u/2913561?v=4","gravatar_id":"","url":"https://api.github.com/users/colini","html_url":"https://github.com/colini","followers_url":"https://api.github.com/users/colini/followers","following_url":"https://api.github.com/users/colini/following{/other_user}","gists_url":"https://api.github.com/users/colini/gists{/gist_id}","starred_url":"https://api.github.com/users/colini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colini/subscriptions","organizations_url":"https://api.github.com/users/colini/orgs","repos_url":"https://api.github.com/users/colini/repos","events_url":"https://api.github.com/users/colini/events{/privacy}","received_events_url":"https://api.github.com/users/colini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-23T12:44:19Z","updated_at":"2018-03-23T12:44:19Z","closed_at":null,"author_association":"NONE","body":"I've written a simple a simple proto that includes this rpc with a stream response:\r\n```protobuf\r\nrpc GetSomeData(GetSomeDataRequest) returns (stream SomeData) {\r\n  option (google.api.http) = {\r\n    get: \"/v1beta1/getData:raw\"\r\n  };\r\n};\r\n```\r\n\r\nMy server replies with 3 SomeData records.  The result from curl via my generated grpc-gateway is:\r\n```\r\n$ curl -i 'http://localhost:8080/v1beta1/getData:raw'\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nGrpc-Metadata-Content-Type: application/grpc\r\nGrpc-Metadata-Grpc-Accept-Encoding: gzip\r\nDate: Fri, 23 Mar 2018 12:30:50 GMT\r\nTransfer-Encoding: chunked\r\n\r\n{\"result\":{\"fund\":\"FUND_0\",\"value\":123.99}}\r\n{\"result\":{\"fund\":\"FUND_1\",\"value\":123.99}}\r\n{\"result\":{\"fund\":\"FUND_2\",\"value\":123.99}}\r\n```\r\nThis appears to be newline-delimited json, which is fine, but it's not valid json.\r\n\r\nAFAIK I'm using the latest grpc-gateway code, which I installed per the instructions:\r\n```\r\ngo get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway\r\ngo get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger\r\ngo get -u github.com/golang/protobuf/protoc-gen-go\r\n```\r\nWith go 1.10\r\n```\r\n$ go version\r\ngo version go1.10 darwin/amd64\r\n```\r\n\r\nIs this the expected stream response format?  I'd suggest enclosing the results in a list, which would add only 1 byte per line (the comma), and would then be valid json:\r\n```json\r\n[\r\n{\"result\":{\"fund\":\"FUND_0\",\"value\":123.99}},\r\n{\"result\":{\"fund\":\"FUND_1\",\"value\":123.99}},\r\n{\"result\":{\"fund\":\"FUND_2\",\"value\":123.99}}\r\n]\r\n```\r\n\r\n(Sorry if this is a repeat of #481, but it wasn't clear how that issue was resolved.)"}}
{"actor":{"display_login":"colini"}}