Skip to content

Commit

Permalink
chore: fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantgoel committed Nov 6, 2024
1 parent cbdf4e9 commit 1ea67d5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions streaming_form_data/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,19 @@ def __init__(self, next_target: Callable):
self._targets = []
self._validator = None # next_target should have a validator

self._next_multipart_filename = None
self._next_multipart_content_type = None

def on_start(self):
target = self._next_target()

if self._next_multipart_filename is not None:
target.set_multipart_filename(self._next_multipart_filename)
self._next_multipart_filename = None
if self._next_multipart_content_type is not None:
target.set_multipart_filename(self._next_multipart_content_type)
self._next_multipart_content_type = None

self._targets.append(target)
target.start()

Expand All @@ -84,10 +94,10 @@ def on_finish(self):
self._targets[-1].finish()

def set_multipart_filename(self, filename: str):
self._targets[-1].set_multipart_filename(filename)
self._next_multipart_filename = filename

def set_multipart_content_type(self, content_type: str):
self._targets[-1].set_multipart_content_type(content_type)
self._next_multipart_content_type = content_type


class NullTarget(BaseTarget):
Expand Down

0 comments on commit 1ea67d5

Please sign in to comment.