Skip to content

Commit

Permalink
Add unit-test to reproduce encoding error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Scrivner committed Dec 17, 2012
1 parent 4701243 commit 916e6fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""Tests for Requests."""

import json
import os
import unittest

Expand Down Expand Up @@ -243,7 +244,14 @@ def test_urlencoded_get_query_multivalued_param(self):
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()
unittest.main()

0 comments on commit 916e6fc

Please sign in to comment.