Encode a list of fields using the multipart/form-data MIME format
(self, *args, **kwargs)
| 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: |
no test coverage detected