Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging form-data prior to processing form data. #378

Merged
merged 1 commit into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stripe/api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ def request_raw(self, method, url, params=None, supplied_headers=None):

util.log_info('Request to Stripe api', method=method, path=abs_url)
util.log_debug(
'Post details', post_data=post_data, api_version=self.api_version)
'Post details',
post_data=encoded_params, api_version=self.api_version)

rbody, rcode, rheaders = self._client.request(
method, abs_url, headers, post_data)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import datetime
import unittest2
import tempfile

from mock import Mock, ANY

Expand Down Expand Up @@ -475,6 +476,15 @@ def test_invalid_grant_error(self):
self.requestor.request,
'get', self.valid_path, {})

def test_raw_request_with_file_param(self):
test_file = tempfile.NamedTemporaryFile()
test_file.write('\u263A'.encode('utf-16'))
test_file.seek(0)
params = {'file': test_file, 'purpose': 'dispute_evidence'}
supplied_headers = {'Content-Type': 'multipart/form-data'}
self.mock_response('{}', 200)
self.requestor.request('post', '/v1/files', params, supplied_headers)


class DefaultClientTests(unittest2.TestCase):

Expand Down