FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Explicitly set boundary for multipart/form-data by linkdd · Pull Request #1005 · openapi-generators/openapi-python-client · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .jinja  (5) .lock  (2) .md  (1) .py  (8) .toml  (9) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 5 additions & 0 deletions .changeset/raise_minimum_httpx_version_to_0231.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: major
---

# Raise minimum httpx version to 0.23.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["my_test_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,16 @@ def _get_kwargs(
if isinstance(body, File):
if not isinstance(body, Unset):
_kwargs["content"] = body.payload

headers["Content-Type"] = "application/octet-stream"
if isinstance(body, PostBodiesMultipleDataBody):
if not isinstance(body, Unset):
_kwargs["data"] = body.to_dict()

headers["Content-Type"] = "application/x-www-form-urlencoded"
if isinstance(body, PostBodiesMultipleFilesBody):
if not isinstance(body, Unset):
_kwargs["files"] = body.to_multipart()

headers["Content-Type"] = "multipart/form-data"
headers["Content-Type"] = "multipart/form-data; boundary=+++"

_kwargs["headers"] = headers
return _kwargs
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def _get_kwargs(

if not isinstance(body, Unset):
_kwargs["content"] = body.payload

headers["Content-Type"] = "application/octet-stream"

_kwargs["headers"] = headers
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def _get_kwargs(
}

_kwargs["data"] = body.to_dict()

headers["Content-Type"] = "application/x-www-form-urlencoded"

_kwargs["headers"] = headers
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def _get_kwargs(
}

_kwargs["data"] = body.to_dict()

headers["Content-Type"] = "application/x-www-form-urlencoded"

_kwargs["headers"] = headers
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def _get_kwargs(

_kwargs["files"] = body.to_multipart()

headers["Content-Type"] = "multipart/form-data; boundary=+++"

_kwargs["headers"] = headers
return _kwargs

Expand Down
2 changes: 1 addition & 1 deletion end_to_end_tests/golden-record/pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["my_test_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def _get_kwargs(
if not isinstance(body, Unset):
_kwargs["files"] = body.to_multipart()

headers["Content-Type"] = "multipart/form-data; boundary=+++"

_kwargs["headers"] = headers
return _kwargs

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["my_enum_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"httpx>=0.23.0,<0.29.0",
"httpx>=0.23.1,<0.29.0",
"attrs>=22.2.0",
]

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["test_3_1_features_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion end_to_end_tests/metadata_snapshots/setup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
long_description_content_type="text/markdown",
packages=find_packages(),
python_requires=">=3.10, <4",
install_requires=["httpx >= 0.23.0, < 0.29.0", "attrs >= 22.2.0"],
install_requires=["httpx >= 0.23.1, < 0.29.0", "attrs >= 22.2.0"],
package_data={"test_3_1_features_client": ["py.typed"]},
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []
requires-python = ">=3.10"
readme = "README.md"
dependencies = [
"httpx>=0.23.0,<0.29.0",
"httpx>=0.23.1,<0.29.0",
"attrs>=22.2.0",
]

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["test_3_1_features_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def _get_kwargs(
if not isinstance(body, Unset):
_kwargs["files"] = body.to_multipart()

headers["Content-Type"] = "multipart/form-data; boundary=+++"

_kwargs["headers"] = headers
return _kwargs

Expand Down
52 changes: 27 additions & 25 deletions integration-tests/pdm.minimal.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
groups = ["default", "dev"]
strategy = ["direct_minimal_versions", "inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:70373f7c996c7e4f5c163216d115b5037e5a03f4bbe72963dd4482c84ff5410b"
content_hash = "sha256:eeb709f45e01d5d34a3c94a4a0b8b9bfdc61c6c2ddeebe1a4462e69c6ea8ad39"

[[metadata.targets]]
requires_python = "~=3.10"

[[package]]
name = "anyio"
version = "3.7.1"
requires_python = ">=3.7"
summary = "High level compatibility layer for multiple asynchronous event loop implementations"
version = "4.13.0"
requires_python = ">=3.10"
summary = "High-level concurrency and networking framework on top of asyncio or Trio"
groups = ["default"]
dependencies = [
"exceptiongroup; python_version < \"3.11\"",
"exceptiongroup>=1.0.2; python_version < \"3.11\"",
"idna>=2.8",
"sniffio>=1.1",
"typing-extensions; python_version < \"3.8\"",
"typing-extensions>=4.5; python_version < \"3.13\"",
]
files = [
{file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"},
{file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"},
{file = "anyio-4.13.0-py3-none-any.whl", hash = "sha256:08b310f9e24a9594186fd75b4f73f4a4152069e3853f1ed8bfbf58369f4ad708"},
{file = "anyio-4.13.0.tar.gz", hash = "sha256:334b70e641fd2221c1505b3890c69882fe4a2df910cba14d97019b90b24439dc"},
]

[[package]]
Expand Down Expand Up @@ -78,58 +77,61 @@ files = [

[[package]]
name = "h11"
version = "0.12.0"
requires_python = ">=3.6"
version = "0.14.0"
requires_python = ">=3.7"
summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
groups = ["default"]
dependencies = [
"typing-extensions; python_version < \"3.8\"",
]
files = [
{file = "h11-0.12.0-py3-none-any.whl", hash = "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6"},
{file = "h11-0.12.0.tar.gz", hash = "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042"},
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
]

[[package]]
name = "httpcore"
version = "0.15.0"
version = "0.16.3"
requires_python = ">=3.7"
summary = "A minimal low-level HTTP client."
groups = ["default"]
dependencies = [
"anyio==3.*",
"anyio<5.0,>=3.0",
"certifi",
"h11<0.13,>=0.11",
"h11<0.15,>=0.13",
"sniffio==1.*",
]
files = [
{file = "httpcore-0.15.0-py3-none-any.whl", hash = "sha256:1105b8b73c025f23ff7c36468e4432226cbb959176eab66864b8e31c4ee27fa6"},
{file = "httpcore-0.15.0.tar.gz", hash = "sha256:18b68ab86a3ccf3e7dc0f43598eaddcf472b602aba29f9aa6ab85fe2ada3980b"},
{file = "httpcore-0.16.3-py3-none-any.whl", hash = "sha256:da1fb708784a938aa084bde4feb8317056c55037247c787bd7e19eb2c2949dc0"},
{file = "httpcore-0.16.3.tar.gz", hash = "sha256:c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb"},
]

[[package]]
name = "httpx"
version = "0.23.0"
version = "0.23.1"
requires_python = ">=3.7"
summary = "The next generation HTTP client."
groups = ["default"]
dependencies = [
"certifi",
"httpcore<0.16.0,>=0.15.0",
"httpcore<0.17.0,>=0.15.0",
"rfc3986[idna2008]<2,>=1.3",
"sniffio",
]
files = [
{file = "httpx-0.23.0-py3-none-any.whl", hash = "sha256:42974f577483e1e932c3cdc3cd2303e883cbfba17fe228b0f63589764d7b9c4b"},
{file = "httpx-0.23.0.tar.gz", hash = "sha256:f28eac771ec9eb4866d3fb4ab65abd42d38c424739e80c08d8d20570de60b0ef"},
{file = "httpx-0.23.1-py3-none-any.whl", hash = "sha256:0b9b1f0ee18b9978d637b0776bfd7f54e2ca278e063e3586d8f01cda89e042a8"},
{file = "httpx-0.23.1.tar.gz", hash = "sha256:202ae15319be24efe9a8bd4ed4360e68fde7b38bcc2ce87088d416f026667d19"},
]

[[package]]
name = "idna"
version = "3.16"
version = "3.17"
requires_python = ">=3.9"
summary = "Internationalized Domain Names in Applications (IDNA)"
groups = ["default"]
files = [
{file = "idna-3.16-py3-none-any.whl", hash = "sha256:cc246e3a3f89580c3a951b5ad298ca4638078b2cdd4f115654332b5c26daded5"},
{file = "idna-3.16.tar.gz", hash = "sha256:d7a6da03db833450fca25d2358ac9ff06cd624577a4aea3a596d5c0f77b8e03d"},
{file = "idna-3.17-py3-none-any.whl", hash = "sha256:466e48829084efe2548012b855df21540b96f2e20e51bd124c851536556a592c"},
{file = "idna-3.17.tar.gz", hash = "sha256:5eb0cb53bc467c12eadcf6de83163ad8527cec9416f44b9b61b19caedad2b87f"},
]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []
readme = "README.md"
requires-python = ">=3.10,<4.0"
dependencies = [
"httpx>=0.23.0,<0.29.0",
"httpx>=0.23.1,<0.29.0",
"attrs>=22.2.0",
]

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ def _get_kwargs(
{% for body in endpoint.bodies %}
if isinstance(body, {{body.prop.get_type_string(no_optional=True) }}):
{{ body_to_kwarg(body) | indent(8) }}
{%- if body.content_type == "multipart/form-data" %}
headers["Content-Type"] = "multipart/form-data; boundary=+++"
{% else %}
headers["Content-Type"] = "{{ body.content_type }}"
{% endif %}
{% endfor %}
{% elif endpoint.bodies | length == 1 %}
{% set body = endpoint.bodies[0] %}
{{ body_to_kwarg(body) | indent(4) }}
{% if body.content_type != "multipart/form-data" %}{# Need httpx to set the boundary automatically #}
{%- if body.content_type == "multipart/form-data" %}
headers["Content-Type"] = "multipart/form-data; boundary=+++"
{% else %}
headers["Content-Type"] = "{{ body.content_type }}"
{% endif %}
{% endif %}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"httpx>=0.23.0,<0.29.0",
"httpx>=0.23.1,<0.29.0",
"attrs>=22.2.0",
]

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include = ["{{ package_name }}/py.typed"]

[tool.poetry.dependencies]
python = "^3.10"
httpx = ">=0.23.0,<0.29.0"
httpx = ">=0.23.1,<0.29.0"
attrs = ">=22.2.0"

[build-system]
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []
requires-python = ">=3.10"
readme = "README.md"
dependencies = [
"httpx>=0.23.0,<0.29.0",
"httpx>=0.23.1,<0.29.0",
"attrs>=22.2.0",
]

Expand Down
2 changes: 1 addition & 1 deletion openapi_python_client/templates/setup.py.jinja
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ setup(
long_description_content_type="text/markdown",
packages=find_packages(),
python_requires=">=3.10, <4",
install_requires=["httpx >= 0.23.0, < 0.29.0", "attrs >= 22.2.0"],
install_requires=["httpx >= 0.23.1, < 0.29.0", "attrs >= 22.2.0"],
package_data={"{{ package_name }}": ["py.typed"]},
)
Loading

Back | FazBrowse Home | New Git URL