restaumatic / vcr-proxy

Proxy for request, response recording and playback
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Review comments #1

Open kfigiela opened 5 years ago

kfigiela commented 5 years ago

https://github.com/restaumatic/vcr-proxy/blob/125154506e36495b1521d2a36b5354d18c3f8789/src/Network/VCR.hs#L29

Several notes:

kozak commented 5 years ago

UTF-8 Handling

While in this particular place (ie. modifyPath) this makes total sense, I am not sure what to do about storage in the cassette yaml file. Maybe I am misunderstanding but if we don't know the encoding apriori, then the only safe way of encoding the URL (and also headers, query, body etc) would be to treat them as binary, which would result in a unreadable cassette file. I would be in favour of leaving the rest of the code as is for the moment and fixing the problem if we run into it. (The most probable first occurrence of the problem would be with a binary request body or response).

kozak commented 5 years ago

Stuff left todo (from slack):

Kamil had the idea to use environment variables to switch the mode to Record, so it could be used in tests like: VCR_MODE=Record stack test --ta "-m dotpay"

kfigiela commented 5 years ago

which would result in a unreadable cassette file

Hmm… welcome to world of encoding or escaping stuff. We can leave this for now if it works. Did you check what happens if we get gzipped response?