{"action":"opened","issue":{"url":"https://api.github.com/repos/h2non/rocky/issues/88","labels_url":"https://api.github.com/repos/h2non/rocky/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/h2non/rocky/issues/88/comments","events_url":"https://api.github.com/repos/h2non/rocky/issues/88/events","html_url":"https://github.com/h2non/rocky/issues/88","id":123235343,"number":88,"title":"Weird crash with retry","user":{"login":"kacperzuk","id":7718341,"avatar_url":"https://avatars.githubusercontent.com/u/7718341?v=3","gravatar_id":"","url":"https://api.github.com/users/kacperzuk","html_url":"https://github.com/kacperzuk","followers_url":"https://api.github.com/users/kacperzuk/followers","following_url":"https://api.github.com/users/kacperzuk/following{/other_user}","gists_url":"https://api.github.com/users/kacperzuk/gists{/gist_id}","starred_url":"https://api.github.com/users/kacperzuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacperzuk/subscriptions","organizations_url":"https://api.github.com/users/kacperzuk/orgs","repos_url":"https://api.github.com/users/kacperzuk/repos","events_url":"https://api.github.com/users/kacperzuk/events{/privacy}","received_events_url":"https://api.github.com/users/kacperzuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-21T08:54:18Z","updated_at":"2015-12-21T08:54:18Z","closed_at":null,"body":"I'm not sure how to describe that, so here's a test case:\r\n\r\n```javascript\r\nconst http = require('http')\r\nconst proxy = require('rocky')()\r\n\r\nproxy\r\n  .get('/*')\r\n  .forward('http://127.0.0.1:3001')\r\n  .retry({})\r\n\r\nproxy.listen(3000)\r\n\r\nhttp.createServer(function (req, res) {\r\n  res.writeHead(500)\r\n  res.write(\"test\");\r\n  res.end()\r\n}).listen(3001)\r\n\r\n// Test requests\r\nhttp.get('http://localhost:3000', function (res) {\r\n  console.log('Response from target server:', res.statusCode)\r\n})\r\n```\r\n\r\nI get this error when running it:\r\n```\r\n_http_outgoing.js:136\r\n      this.outputSize += this._header.length;\r\n                                     ^\r\n\r\nTypeError: Cannot read property 'length' of null\r\n    at ServerResponse.OutgoingMessage._send (_http_outgoing.js:136:38)\r\n    at ServerResponse.OutgoingMessage.write (_http_outgoing.js:474:16)\r\n    at IncomingMessage.ondata (_stream_readable.js:529:20)\r\n    at emitOne (events.js:78:13)\r\n    at IncomingMessage.emit (events.js:170:7)\r\n    at IncomingMessage.Readable.read (_stream_readable.js:361:10)\r\n    at flow (_stream_readable.js:744:26)\r\n    at resume_ (_stream_readable.js:724:3)\r\n    at nextTickCallbackWith2Args (node.js:455:9)\r\n    at process._tickCallback (node.js:369:17)\r\n```\r\n\r\nWhat is interesting, is that it stops crashing if I only remove line `res.write(\"test\")`.\r\n\r\nIs there something I'm doing wrong?"}}