Skip to content

Commit

Permalink
Rename bodyproducer to data_to_body_producer as per review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cyli committed Jul 8, 2015
1 parent ca78637 commit dadb419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions treq/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def deliverBody(self, protocol):


class HTTPClient(object):
def __init__(self, agent, cookiejar=None, bodyproducer=IBodyProducer):
def __init__(self, agent, cookiejar=None,
data_to_body_producer=IBodyProducer):
self._agent = agent
self._cookiejar = cookiejar or cookiejar_from_dict({})
self._bodyproducer = bodyproducer
self._data_to_body_producer = data_to_body_producer

def get(self, url, **kwargs):
return self.request('GET', url, **kwargs)
Expand Down Expand Up @@ -162,7 +163,7 @@ def request(self, method, url, **kwargs):
headers.setRawHeaders(
'content-type', ['application/x-www-form-urlencoded'])
data = urlencode(data, doseq=True)
bodyProducer = self._bodyproducer(data)
bodyProducer = self._data_to_body_producer(data)

cookies = kwargs.get('cookies', {})

Expand Down
2 changes: 1 addition & 1 deletion treq/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __init__(self, resource):
treq.content functions.
"""
self._client = HTTPClient(agent=RequestTraversalAgent(resource),
bodyproducer=SynchronousProducer)
data_to_body_producer=SynchronousProducer)
for function_name in treq.__all__:
function = getattr(self._client, function_name, None)
if function is None:
Expand Down

0 comments on commit dadb419

Please sign in to comment.