File tree Expand file tree Collapse file tree
openapi_python_client/templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,13 +51,20 @@ def _get_kwargs(
5151 {% set destination = "_" + body .body_type + "_body" %}
5252 {{ body_to_kwarg(body, destination) | indent(8) }}
5353 _kwargs["{{ body.body_type.value }}"] = {{ destination }}
54+ {% if body .content_type == "multipart/form-data" %}
55+ headers["Content-Type"] = "multipart/form-data; boundary=+++"
56+ {% else %}
5457 headers["Content-Type"] = "{{ body.content_type }}"
58+ {% endif %}
59+
5560{% endfor %}
5661{% elif endpoint .bodies | length == 1 %}
5762{% set body = endpoint .bodies [0] %}
5863 {{ body_to_kwarg(body, "_body") | indent(4) }}
5964 _kwargs["{{ body.body_type.value }}"] = _body
60- {% if body .content_type != "multipart/form-data" %} {# Need httpx to set the boundary automatically #}
65+ {% if body .content_type == "multipart/form-data" %}
66+ headers["Content-Type"] = "multipart/form-data; boundary=+++"
67+ {% else %}
6168 headers["Content-Type"] = "{{ body.content_type }}"
6269 {% endif %}
6370{% endif %}
You can’t perform that action at this time.
0 commit comments