{"action":"created","issue":{"url":"https://api.github.com/repos/zalando/tailor/issues/258","repository_url":"https://api.github.com/repos/zalando/tailor","labels_url":"https://api.github.com/repos/zalando/tailor/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/zalando/tailor/issues/258/comments","events_url":"https://api.github.com/repos/zalando/tailor/issues/258/events","html_url":"https://github.com/zalando/tailor/pull/258","id":358691839,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MzY2ODAz","number":258,"title":"(fix): handle streams in object mode while buffering","user":{"login":"vigneshshanmugam","id":3902525,"node_id":"MDQ6VXNlcjM5MDI1MjU=","avatar_url":"https://avatars1.githubusercontent.com/u/3902525?v=4","gravatar_id":"","url":"https://api.github.com/users/vigneshshanmugam","html_url":"https://github.com/vigneshshanmugam","followers_url":"https://api.github.com/users/vigneshshanmugam/followers","following_url":"https://api.github.com/users/vigneshshanmugam/following{/other_user}","gists_url":"https://api.github.com/users/vigneshshanmugam/gists{/gist_id}","starred_url":"https://api.github.com/users/vigneshshanmugam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vigneshshanmugam/subscriptions","organizations_url":"https://api.github.com/users/vigneshshanmugam/orgs","repos_url":"https://api.github.com/users/vigneshshanmugam/repos","events_url":"https://api.github.com/users/vigneshshanmugam/events{/privacy}","received_events_url":"https://api.github.com/users/vigneshshanmugam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-10T16:07:37Z","updated_at":"2018-09-10T16:12:20Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/zalando/tailor/pulls/258","html_url":"https://github.com/zalando/tailor/pull/258","diff_url":"https://github.com/zalando/tailor/pull/258.diff","patch_url":"https://github.com/zalando/tailor/pull/258.patch"},"body":"This is a edge case because stringifier deals only with fragment streams which are not supposed to be in object mode, But using handleTags, we can parse arbitrary tags and send streams in objectMode to the response stream. \r\n\r\nSince [`decodeStrings`](https://nodejs.org/api/stream.html#stream_constructor_new_stream_writable_options) is set to true for fragment streams, all data will be passed as buffers and Buffer.concat would work well. But on objectMode streams, this will not happen and chunks are not decoded as buffers instead left as [arbitrary data chunks](https://github.com/nodejs/node/blob/master/lib/_stream_writable.js#L338)\r\n\r\nThis PR handles this case when chunks are not buffers. \r\n\r\nWithout this fix, we will see an issue like this, \r\n\r\n```js\r\nUncaught TypeError [ERR_INVALID_ARG_TYPE]: The \"list[0]\" argument must be one of type Array, Buffer, or Uint8Array. Received type string\r\n at Function.concat (buffer.js:479:13)\r\n at StringifierStream.onEnd (lib/streams/stringifier-stream.js:48:26)\r\n at StringifierStream.next (lib/streams/stringifier-stream.js:37:22)\r\n at StringifierStream.next (lib/streams/stringifier-stream.js:43:18)\r\n at StringifierStream.processNext (lib/streams/stringifier-stream.js:55:14)\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/zalando/tailor/issues/comments/419970156","html_url":"https://github.com/zalando/tailor/pull/258#issuecomment-419970156","issue_url":"https://api.github.com/repos/zalando/tailor/issues/258","id":419970156,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTk3MDE1Ng==","user":{"login":"topicus","id":381224,"node_id":"MDQ6VXNlcjM4MTIyNA==","avatar_url":"https://avatars0.githubusercontent.com/u/381224?v=4","gravatar_id":"","url":"https://api.github.com/users/topicus","html_url":"https://github.com/topicus","followers_url":"https://api.github.com/users/topicus/followers","following_url":"https://api.github.com/users/topicus/following{/other_user}","gists_url":"https://api.github.com/users/topicus/gists{/gist_id}","starred_url":"https://api.github.com/users/topicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topicus/subscriptions","organizations_url":"https://api.github.com/users/topicus/orgs","repos_url":"https://api.github.com/users/topicus/repos","events_url":"https://api.github.com/users/topicus/events{/privacy}","received_events_url":"https://api.github.com/users/topicus/received_events","type":"User","site_admin":false},"created_at":"2018-09-10T16:12:20Z","updated_at":"2018-09-10T16:12:20Z","author_association":"NONE","body":":+1:"}}
{"actor":{"display_login":"topicus"}}