Add unit-test to reproduce encoding error.
authorEric Scrivner <eric@grapheffect.com>
Mon, 17 Dec 2012 20:28:08 +0000 (12:28 -0800)
committerEric Scrivner <eric@grapheffect.com>
Mon, 17 Dec 2012 20:28:08 +0000 (12:28 -0800)
test_requests.py

index 61634cd..e55a4cf 100644 (file)
@@ -3,6 +3,7 @@
 
 """Tests for Requests."""
 
+import json
 import os
 import unittest
 
@@ -243,7 +244,14 @@ class RequestsTestCase(unittest.TestCase):
         self.assertEqual(r.status_code, 200)
         self.assertEqual(r.url, httpbin('get?test=foo&test=baz'))
 
+    def test_different_encodings_dont_break_post(self):
+        r = requests.post(httpbin('post'),
+                          data={'stuff': json.dumps({'a': 123})},
+                          params={'blah': 'asdf1234'},
+                          files={'file': ('test_requests.py', open(__file__, 'rb'))})
+        self.assertEqual(r.status_code, 200)
+
 
 
 if __name__ == '__main__':
-    unittest.main()
\ No newline at end of file
+    unittest.main()