assaf / node-replay

When API testing slows you down: record and replay HTTP responses like a boss
http://documentup.com/assaf/node-replay
MIT License
522 stars 107 forks source link

Empty header, when trimmed of whitespace, causes matching error #172

Open DTrejo opened 4 years ago

DTrejo commented 4 years ago

Related: #153

An error where you can't slice on null will happen if your editor trims the whitespace off an empty header, like so:

-x-i-am-an-empty-header: 
+x-i-am-an-empty-header:

Here's the relevant line in catalog.js:

      if (line === '') continue;

      var _line$match$slice = line.match(/^(.*?)\:\s+(.*)$/).slice(1), // ← here
          _line$match$slice2 = (0, _slicedToArray3.default)(_line$match$slice, 2);

Solution(s)

Thanks for Replay!