fix: multipart logic
@@ -256,11 +256,15 @@ class Multipart(IODescriptor[t.Dict[str, t.Any]], descriptor_id="bentoml.io.Mult
form_values = await populate_multipart_requests(request)
res = {}
+ repopulate = False
for field, descriptor in self._inputs.items():
if field not in form_values:
+ repopulate = True
break
- res[field] = descriptor.from_http_request(form_values[field])
- else: # NOTE: This is similar to goto, when there is no break.
+ res[field] = await descriptor.from_http_request(form_values[field])
+
+ if repopulate:
+ # break happened;
to_populate = zip(self._inputs.values(), form_values.values())
reqs = await asyncio.gather(
*tuple(io_.from_http_request(req) for io_, req in to_populate)
