Skip to content

Commit

Permalink
fix #1525: add missing sub MultipartWriter headers
Browse files Browse the repository at this point in the history
When appending MultipartWriter objects to another MultipartWriter use
the subwriter's headers in the constructed BodyPartWriter

fixes issue #1525
  • Loading branch information
terencehonles committed Jan 7, 2017
1 parent 63d1ad5 commit 1e71630
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aiohttp/multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,11 @@ class BodyPartWriter(object):
"""Multipart writer for single body part."""

def __init__(self, obj, headers=None, *, chunk_size=8192):
if headers is None:
if isinstance(obj, MultipartWriter):
if headers is not None:
obj.headers.update(headers)
headers = obj.headers
elif headers is None:
headers = CIMultiDict()
elif not isinstance(headers, CIMultiDict):
headers = CIMultiDict(headers)
Expand Down

0 comments on commit 1e71630

Please sign in to comment.