MCPcopy
hub / github.com/aio-libs/aiohttp / _gen_form_data

Method _gen_form_data

aiohttp/helpers.py:146–155  ·  view source on GitHub ↗

Encode a list of fields using the multipart/form-data MIME format

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

144 return data.encode(encoding)
145
146 def _gen_form_data(self, *args, **kwargs):
147 """Encode a list of fields using the multipart/form-data MIME format"""
148 for dispparams, headers, value in self._fields:
149 part = self._writer.append(value, headers)
150 if dispparams:
151 part.set_content_disposition('form-data', **dispparams)
152 # FIXME cgi.FieldStorage doesn't likes body parts with
153 # Content-Length which were sent via chunked transfer encoding
154 part.headers.pop(hdrs.CONTENT_LENGTH, None)
155 yield from self._writer.serialize()
156
157 def __call__(self, encoding):
158 if self._is_multipart:

Callers 1

__call__Method · 0.95

Calls 3

appendMethod · 0.80
serializeMethod · 0.45

Tested by

no test coverage detected