Closed tcnguyen closed 6 years ago
This PR will cause node-reply to respond with fixtures but remove any CRs from them, even if the CR was part of the response. It will also truncate response bodies that have double LFs.
If these CRs were not stored in the response document by node-replay, then they were probably introduced by a text editor. In which case, I suggest using a text-editor that does not modify (add or remove) end of line characters.
I see this got closed, but this is a bigger problem than just the text editor.
Because of the behavior of GIT.
Git will cause a working replay to become corrupted when re-downloaded to a machine from a repo by default. It will works locally until checked back out and will even work remotely in say jenkins if the repo is unix, and will work on co-workers linux boxes, but when downloaded back to the same machine that generated it in windows, it becomes broken.
Without a proper .gitattributes file (e.g. /*/replay text eol=lf), or if generated and/or edited without .gitconfig being set properly (e.g. git config --global core.autocrlf input) they will fail when tests are run locally.
On windows fixtures files can have \r\n as line break instead of \n in linux or mac. This will break the replay.
A simple fix for that is to remove the \r when reading the fixtures files