fix issue with building bad POST requests
Add regression test for #13.