sideshowcoder / canned

Server to respond with fake API responses, by using a directory of files for finding out what to say!
213 stars 46 forks source link

CR/LF causing "Unexpected token" with variable responses. #79

Closed andy-otter closed 8 years ago

andy-otter commented 8 years ago

On Windows 7. Having a file as follows with CR/LFs at the end of each line causes an "Unexpected token". Converting the EOL to LF works as expected.

Node version is 0.12.2 (x64) on Windows 7

//! params: {"serialkey": "abc"} { "errorCode": "ERROR1" }

//! params: {"serialkey": "12121"} { "errorCode": "ERROR2" }

sideshowcoder commented 8 years ago

Ugh that is not nice :( happy to accept a PR for it as I normally am not on a windows machine, but I can set one up I guess. Thanks for the report!

andy-otter commented 8 years ago

I'll take a look and see if I can get a PR sorted out in the next few days or so.

sideshowcoder commented 8 years ago

Thanks @andy-otter that would be awesome. I assume it is a problem with the filtering of comments. If you could create a test to start out with that would be super helpful!

andy-otter commented 8 years ago

Could take a while to sort this out, have to create a linux env as the test cases filenames have characters that aren't supported by Windows (for example, ?) so can't actively do development.

Bear with me and i'll get it sorted in due time (teaches me for using Windows!)

sideshowcoder commented 8 years ago

:( Oh yeah, could you create a failing test on windows which shows the problem and commit this to a branch? Than I can try to work on this locally for me as well maybe we get there faster when we both look into it? Also would setting up a vagrantfile help?

andy-otter commented 8 years ago

Bit new to this, i'm trying to push a new branch to the repo - however it looks like you may need to add my account as a contributor ?

sideshowcoder commented 8 years ago

No problem, so what you can do is click the fork button and push you branch to the forked version under your username. Than you can open a pull request from there, it will probably offer this when you go to your repository and pushed the new branch of yours. Then we can continue the discussion on the pull request. Hope this works for you, feel free to ask if you have any trouble! Also you might find https://help.github.com/articles/using-pull-requests/ helpful. Thanks so much for the work!

On Sat, Nov 14, 2015 at 1:15 PM -0800, "andy-otter" notifications@github.com<mailto:notifications@github.com> wrote:

Bit new to this, i'm trying to push a new branch to the repo - however it looks like you may need to add my account as a contributor ?

Reply to this email directly or view it on GitHubhttps://github.com/sideshowcoder/canned/issues/79#issuecomment-156746343.

git-jiby-me commented 8 years ago

@andy-otter fixed with https://github.com/sideshowcoder/canned/pull/83