hoodunit / purescript-payload

An HTTP server and client library for PureScript
Apache License 2.0
100 stars 11 forks source link

Remove \r from file responses to match expected unix file contents. #18

Closed jsparkes closed 3 years ago

jsparkes commented 3 years ago

I built and tested payload on Windows 10. A number of the file serve tests failed. I have the git option autocrlf on, so the example files got their newlines converted to windows format, \r\n. I tried to find a way to mark the example files as binary using .gitattributes, but didn't find an acceptable solution. So I modified the tests to strip out the \r from the response bodies before checking for expect results.

Now all 250 tests pass on windows as well.

hoodunit commented 3 years ago

Thanks for testing this on Windows! I would prefer for this to be handled through the .gitattributes file (likely by marking as text eol=lf?) or project-specific git settings if possible. If you figure out the settings for that I'd be happy to merge it in. The file being returned by the server in tests should be exactly what is on disk/in Git, i.e. the file with Linux line endings, so I don't think it makes sense to adjust all tests to remove \r. There may also be cases where we specifically want to preserve \r from the original file as well and it would be bit unexpected for those to be removed in tests.

hoodunit commented 3 years ago

Closing this for now, feel free to open another via e.g. the above approach.