Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cd03164
Update dependencies
Aug 20, 2025
1b1d713
Update dependencies (2025-08-20 07:05:18)
Aug 20, 2025
a4eebaf
Regenerate for typespec-python (2025-08-20 07:10:21)
Aug 20, 2025
5d9e2bb
Regenerate for autorest.python (2025-08-20 07:26:32)
Aug 20, 2025
5b39054
Update dependencies
Aug 20, 2025
fc05944
Update dependencies (2025-08-20 08:40:21)
Aug 20, 2025
c57b9bd
Regenerate for typespec-python (2025-08-20 08:45:17)
Aug 20, 2025
8fef663
Regenerate for autorest.python (2025-08-20 09:01:46)
Aug 20, 2025
864c792
Update dependencies
Aug 20, 2025
a5d0316
Update dependencies (2025-08-20 11:18:46)
Aug 20, 2025
647707d
Regenerate for typespec-python (2025-08-20 11:23:56)
Aug 20, 2025
ae76434
Regenerate for autorest.python (2025-08-20 11:40:51)
Aug 20, 2025
2997ef8
Update dependencies
Aug 21, 2025
f9948fb
Update dependencies (2025-08-21 08:34:49)
Aug 21, 2025
8bb5c8c
Regenerate for autorest.python (2025-08-21 08:55:54)
Aug 21, 2025
3a83dd9
Update dependencies
Aug 21, 2025
ffaa9ed
Update dependencies (2025-08-21 09:51:56)
Aug 21, 2025
f60672d
Regenerate for typespec-python (2025-08-21 09:56:47)
Aug 21, 2025
cf35d7b
Regenerate for autorest.python (2025-08-21 10:12:56)
Aug 21, 2025
2149319
Merge branch 'main' into auto-microsoft-python-fix-optional-body
msyyc Aug 21, 2025
3349136
Update dependencies
Aug 22, 2025
2f047c7
Update dependencies (2025-08-22 01:28:18)
Aug 22, 2025
b393881
Regenerate for typespec-python (2025-08-22 01:33:36)
Aug 22, 2025
f4167a8
Regenerate for autorest.python (2025-08-22 01:50:51)
Aug 22, 2025
fcacd4f
Update dependencies
Aug 22, 2025
0dbbb81
Update dependencies (2025-08-22 02:22:35)
Aug 22, 2025
d639c39
Regenerate for typespec-python (2025-08-22 02:27:38)
Aug 22, 2025
239c835
Regenerate for autorest.python (2025-08-22 02:44:07)
Aug 22, 2025
9327f60
add changelog
msyyc Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

don't send content-type when no request body
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTIzMzU2Mi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.15.2.tgz",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTI0ODczMy9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.15.2.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def _basic_polling_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -233,6 +234,7 @@ def begin_basic_polling(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[JSON] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ async def _basic_polling_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -204,6 +205,7 @@ async def begin_basic_polling(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[JSON] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ async def _test_lro_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -220,6 +221,7 @@ async def begin_test_lro(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ def _test_lro_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -296,6 +297,7 @@ def begin_test_lro(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ async def test_two(

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if parameter_one else None
cls: ClsType[_models.ModelTwo] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if parameter_one else None
_json = None
_content = None
if isinstance(parameter_one, (IOBase, bytes)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def test_two(

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if parameter_one else None
cls: ClsType[_models.ModelTwo] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if parameter_one else None
_json = None
_content = None
if isinstance(parameter_one, (IOBase, bytes)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@ async def test_two(

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "3.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if parameter_one else None
cls: ClsType[_models.ModelThree] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if parameter_one else None
_json = None
_content = None
if isinstance(parameter_one, (IOBase, bytes)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async def test_four(self, input: Optional[Union[_models.SourcePath, IO[bytes]]]

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "3.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if input else None
cls: ClsType[None] = kwargs.pop("cls", None)

_json = None
Expand All @@ -121,7 +122,7 @@ async def test_four(self, input: Optional[Union[_models.SourcePath, IO[bytes]]]
_json = self._serialize.body(input, "SourcePath")
else:
_json = None
content_type = content_type or "application/json"
content_type = content_type or "application/json" if input else None

_request = build_test_four_request(
api_version=api_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ def test_two(

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "3.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if parameter_one else None
cls: ClsType[_models.ModelThree] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if parameter_one else None
_json = None
_content = None
if isinstance(parameter_one, (IOBase, bytes)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def test_four( # pylint: disable=inconsistent-return-statements

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "3.0.0"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if input else None
cls: ClsType[None] = kwargs.pop("cls", None)

_json = None
Expand All @@ -166,7 +167,7 @@ def test_four( # pylint: disable=inconsistent-return-statements
_json = self._serialize.body(input, "SourcePath")
else:
_json = None
content_type = content_type or "application/json"
content_type = content_type or "application/json" if input else None

_request = build_test_four_request(
api_version=api_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ async def _put_async_retry_succeeded_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -191,6 +192,7 @@ async def begin_put_async_retry_succeeded(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -253,9 +255,10 @@ async def _put201_creating_succeeded200_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -359,6 +362,7 @@ async def begin_put201_creating_succeeded200(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -413,9 +417,10 @@ async def _post202_retry200_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -517,6 +522,7 @@ async def begin_post202_retry200(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -567,9 +573,10 @@ async def _post_async_retry_succeeded_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -677,6 +684,7 @@ async def begin_post_async_retry_succeeded(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ async def _put201_creating_succeeded200_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -184,6 +185,7 @@ async def begin_put201_creating_succeeded200(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -238,9 +240,10 @@ async def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-t
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -348,6 +351,7 @@ async def begin_put_async_relative_retry_succeeded(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[_models.Product] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -695,9 +699,10 @@ async def _post202_retry200_initial(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -796,6 +801,7 @@ async def begin_post202_retry200(
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down Expand Up @@ -846,9 +852,10 @@ async def _post_async_relative_retry_succeeded_initial( # pylint: disable=name-
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
content_type = content_type or "application/json" if product else None
_json = None
_content = None
if isinstance(product, (IOBase, bytes)):
Expand Down Expand Up @@ -953,6 +960,7 @@ async def begin_post_async_relative_retry_succeeded( # pylint: disable=name-too
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
content_type = content_type if product else None
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Loading
Loading