diff --git a/.chronus/changes/auto-microsoft-python-fix-optional-body-2025-7-22-10-56-50.md b/.chronus/changes/auto-microsoft-python-fix-optional-body-2025-7-22-10-56-50.md new file mode 100644 index 00000000000..09d124055ed --- /dev/null +++ b/.chronus/changes/auto-microsoft-python-fix-optional-body-2025-7-22-10-56-50.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +don't send content-type when no request body \ No newline at end of file diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index 7d6d5aaf2e0..7f5a0ce40aa 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -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" diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py index c98666b4a7b..eb492b0bcba 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py index 7df348790cc..c07aa1e3ca8 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py index e84e9fb235b..17be9460694 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py index 404ae4f31ca..66afa53f524 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py index 98dfc0ce7e7..dc803572dcb 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py index bc9e2582829..185c6187660 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py index bd30e2ff1e1..916d0fbb099 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py index bfc87390709..4fad9a72578 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py index e1f441f20b1..209b30a9b6f 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py index a95234a9a1d..e20d41067fd 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py index 292a1db6fd1..5ababf1df3a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py @@ -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)): @@ -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) @@ -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)): @@ -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) @@ -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)): @@ -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) @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py index cad56f5b27f..b17ec93e1c5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py @@ -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)): @@ -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) @@ -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)): @@ -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) @@ -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)): @@ -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) @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py index 9368bd50e24..7082da3bb09 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py @@ -119,9 +119,10 @@ async def _put200_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)): @@ -219,6 +220,7 @@ async def begin_put200_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) @@ -273,9 +275,10 @@ async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-to _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)): @@ -378,6 +381,7 @@ async def begin_patch200_succeeded_ignore_headers( _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) @@ -438,9 +442,10 @@ async def _patch201_retry_with_async_header_initial( # 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[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)): @@ -541,6 +546,7 @@ async def begin_patch201_retry_with_async_header( _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) @@ -595,9 +601,10 @@ async def _patch202_retry_with_async_and_location_header_initial( # pylint: dis _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)): @@ -702,6 +709,7 @@ async def begin_patch202_retry_with_async_and_location_header( # pylint: disabl _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) @@ -756,9 +764,10 @@ async def _put201_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)): @@ -856,6 +865,7 @@ async def begin_put201_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) @@ -1007,9 +1017,10 @@ async def _put200_succeeded_no_state_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)): @@ -1107,6 +1118,7 @@ async def begin_put200_succeeded_no_state( _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) @@ -1161,9 +1173,10 @@ async def _put202_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)): @@ -1264,6 +1277,7 @@ async def begin_put202_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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1318,9 +1332,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)): @@ -1421,6 +1436,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) @@ -1475,9 +1491,10 @@ async def _put200_updating_succeeded204_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)): @@ -1578,6 +1595,7 @@ async def begin_put200_updating_succeeded204( _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) @@ -1632,9 +1650,10 @@ async def _put201_creating_failed200_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)): @@ -1735,6 +1754,7 @@ async def begin_put201_creating_failed200( _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) @@ -1789,9 +1809,10 @@ async def _put200_acceptedcanceled200_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)): @@ -1892,6 +1913,7 @@ async def begin_put200_acceptedcanceled200( _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) @@ -1946,9 +1968,10 @@ async def _put_no_header_in_retry_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)): @@ -2049,6 +2072,7 @@ async def begin_put_no_header_in_retry( _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) @@ -2107,9 +2131,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)): @@ -2217,6 +2242,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) @@ -2279,9 +2305,10 @@ async def _put_async_no_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)): @@ -2388,6 +2415,7 @@ async def begin_put_async_no_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) @@ -2449,9 +2477,10 @@ async def _put_async_retry_failed_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)): @@ -2559,6 +2588,7 @@ async def begin_put_async_retry_failed( _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) @@ -2621,9 +2651,10 @@ async def _put_async_no_retrycanceled_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)): @@ -2730,6 +2761,7 @@ async def begin_put_async_no_retrycanceled( _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) @@ -2791,9 +2823,10 @@ async def _put_async_no_header_in_retry_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)): @@ -2899,6 +2932,7 @@ async def begin_put_async_no_header_in_retry( _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) @@ -2959,9 +2993,10 @@ async def _put_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -3052,6 +3087,7 @@ async def begin_put_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku else None cls: ClsType[_models.Sku] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3101,9 +3137,10 @@ async def _put_async_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -3194,6 +3231,7 @@ async def begin_put_async_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku else None cls: ClsType[_models.Sku] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4672,9 +4710,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)): @@ -4773,6 +4812,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) @@ -4823,9 +4863,10 @@ async def _post202_no_retry204_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)): @@ -4927,6 +4968,7 @@ async def begin_post202_no_retry204( _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) @@ -5276,9 +5318,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)): @@ -5387,6 +5430,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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -5441,9 +5485,10 @@ async def _post_async_no_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)): @@ -5552,6 +5597,7 @@ async def begin_post_async_no_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) @@ -5606,9 +5652,10 @@ async def _post_async_retry_failed_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)): @@ -5713,6 +5760,7 @@ async def begin_post_async_retry_failed( _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) @@ -5763,9 +5811,10 @@ async def _post_async_retrycanceled_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)): @@ -5870,6 +5919,7 @@ async def begin_post_async_retrycanceled( _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) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py index 3c2d4bd04a4..aa3ee40016f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py @@ -101,9 +101,10 @@ async def _put_non_retry400_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)): @@ -198,6 +199,7 @@ async def begin_put_non_retry400( _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) @@ -252,9 +254,10 @@ async def _put_non_retry201_creating400_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)): @@ -352,6 +355,7 @@ async def begin_put_non_retry201_creating400( _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) @@ -406,9 +410,10 @@ async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable _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)): @@ -506,6 +511,7 @@ async def begin_put_non_retry201_creating400_invalid_json( # pylint: disable=na _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) @@ -560,9 +566,10 @@ async def _put_async_relative_retry400_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)): @@ -667,6 +674,7 @@ async def begin_put_async_relative_retry400( _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) @@ -997,9 +1005,10 @@ async def _post_non_retry400_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)): @@ -1095,6 +1104,7 @@ async def begin_post_non_retry400( _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) @@ -1145,9 +1155,10 @@ async def _post202_non_retry400_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)): @@ -1243,6 +1254,7 @@ async def begin_post202_non_retry400( _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) @@ -1293,9 +1305,10 @@ async def _post_async_relative_retry400_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)): @@ -1397,6 +1410,7 @@ async def begin_post_async_relative_retry400( _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) @@ -1447,9 +1461,10 @@ async def _put_error201_no_provisioning_state_payload_initial( # pylint: disabl _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)): @@ -1544,6 +1559,7 @@ async def begin_put_error201_no_provisioning_state_payload( # pylint: disable=n _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) @@ -1598,9 +1614,10 @@ async def _put_async_relative_retry_no_status_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)): @@ -1708,6 +1725,7 @@ async def begin_put_async_relative_retry_no_status( _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) @@ -1770,9 +1788,10 @@ async def _put_async_relative_retry_no_status_payload_initial( # pylint: disabl _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)): @@ -1880,6 +1899,7 @@ async def begin_put_async_relative_retry_no_status_payload( # pylint: disable=n _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) @@ -2122,9 +2142,10 @@ async def _post202_no_location_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)): @@ -2223,6 +2244,7 @@ async def begin_post202_no_location( _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) @@ -2273,9 +2295,10 @@ async def _post_async_relative_retry_no_payload_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)): @@ -2380,6 +2403,7 @@ async def begin_post_async_relative_retry_no_payload( # pylint: disable=name-to _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) @@ -2430,9 +2454,10 @@ async def _put200_invalid_json_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)): @@ -2530,6 +2555,7 @@ async def begin_put200_invalid_json( _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) @@ -2584,9 +2610,10 @@ async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=n _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)): @@ -2694,6 +2721,7 @@ async def begin_put_async_relative_retry_invalid_header( # 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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2756,9 +2784,10 @@ async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: dis _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)): @@ -2866,6 +2895,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( # pylint: disabl _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) @@ -3209,9 +3239,10 @@ async def _post202_retry_invalid_header_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)): @@ -3310,6 +3341,7 @@ async def begin_post202_retry_invalid_header( _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) @@ -3360,9 +3392,10 @@ async def _post_async_relative_retry_invalid_header_initial( # pylint: disable= _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)): @@ -3467,6 +3500,7 @@ async def begin_post_async_relative_retry_invalid_header( # pylint: disable=nam _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) @@ -3517,9 +3551,10 @@ async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: di _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)): @@ -3624,6 +3659,7 @@ async def begin_post_async_relative_retry_invalid_json_polling( # pylint: disab _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) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py index 5fd234ecc8f..650d4891e6f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py @@ -143,9 +143,10 @@ 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[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)): @@ -253,6 +254,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -315,9 +317,10 @@ 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[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)): @@ -418,6 +421,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -472,9 +476,10 @@ 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[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)): @@ -576,6 +581,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -626,9 +632,10 @@ 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[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)): @@ -736,6 +743,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py index a0a324033f9..e5cf513eb50 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py @@ -188,9 +188,10 @@ 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[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)): @@ -288,6 +289,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -342,9 +344,10 @@ def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lon _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)): @@ -449,6 +452,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -795,9 +799,10 @@ 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[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)): @@ -896,6 +901,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -946,9 +952,10 @@ def _post_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lo _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)): @@ -1053,6 +1060,7 @@ def begin_post_async_relative_retry_succeeded( # pylint: disable=name-too-long _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py index 31c3cf5883d..9474804fbfa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -785,9 +785,10 @@ def _put200_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[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)): @@ -882,6 +883,7 @@ def begin_put200_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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -936,9 +938,10 @@ def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long _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)): @@ -1038,6 +1041,7 @@ def begin_patch200_succeeded_ignore_headers( _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) @@ -1098,9 +1102,10 @@ def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long _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)): @@ -1198,6 +1203,7 @@ def begin_patch201_retry_with_async_header( _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) @@ -1252,9 +1258,10 @@ def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=n _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)): @@ -1356,6 +1363,7 @@ def begin_patch202_retry_with_async_and_location_header( # 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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1410,9 +1418,10 @@ def _put201_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[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)): @@ -1507,6 +1516,7 @@ def begin_put201_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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1656,9 +1666,10 @@ def _put200_succeeded_no_state_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)): @@ -1753,6 +1764,7 @@ def begin_put200_succeeded_no_state( _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) @@ -1807,9 +1819,10 @@ def _put202_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[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)): @@ -1907,6 +1920,7 @@ def begin_put202_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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1961,9 +1975,10 @@ 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[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)): @@ -2061,6 +2076,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2115,9 +2131,10 @@ def _put200_updating_succeeded204_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)): @@ -2215,6 +2232,7 @@ def begin_put200_updating_succeeded204( _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) @@ -2269,9 +2287,10 @@ def _put201_creating_failed200_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)): @@ -2369,6 +2388,7 @@ def begin_put201_creating_failed200( _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) @@ -2423,9 +2443,10 @@ def _put200_acceptedcanceled200_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)): @@ -2523,6 +2544,7 @@ def begin_put200_acceptedcanceled200( _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) @@ -2577,9 +2599,10 @@ def _put_no_header_in_retry_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)): @@ -2677,6 +2700,7 @@ def begin_put_no_header_in_retry( _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) @@ -2735,9 +2759,10 @@ 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[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)): @@ -2842,6 +2867,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2904,9 +2930,10 @@ def _put_async_no_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[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)): @@ -3010,6 +3037,7 @@ def begin_put_async_no_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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3071,9 +3099,10 @@ def _put_async_retry_failed_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)): @@ -3178,6 +3207,7 @@ def begin_put_async_retry_failed( _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) @@ -3240,9 +3270,10 @@ def _put_async_no_retrycanceled_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)): @@ -3346,6 +3377,7 @@ def begin_put_async_no_retrycanceled( _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) @@ -3407,9 +3439,10 @@ def _put_async_no_header_in_retry_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)): @@ -3512,6 +3545,7 @@ def begin_put_async_no_header_in_retry( _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) @@ -3572,9 +3606,10 @@ def _put_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -3665,6 +3700,7 @@ def begin_put_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku else None cls: ClsType[_models.Sku] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3712,9 +3748,10 @@ def _put_async_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -3805,6 +3842,7 @@ def begin_put_async_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku else None cls: ClsType[_models.Sku] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -5270,9 +5308,10 @@ 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[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)): @@ -5371,6 +5410,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -5421,9 +5461,10 @@ def _post202_no_retry204_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)): @@ -5522,6 +5563,7 @@ def begin_post202_no_retry204( _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) @@ -5867,9 +5909,10 @@ 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[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)): @@ -5975,6 +6018,7 @@ 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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -6029,9 +6073,10 @@ def _post_async_no_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[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)): @@ -6137,6 +6182,7 @@ def begin_post_async_no_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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -6191,9 +6237,10 @@ def _post_async_retry_failed_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)): @@ -6298,6 +6345,7 @@ def begin_post_async_retry_failed( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -6348,9 +6396,10 @@ def _post_async_retrycanceled_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)): @@ -6455,6 +6504,7 @@ def begin_post_async_retrycanceled( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py index fe3e85eb4fe..2617f64276c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -512,9 +512,10 @@ def _put_non_retry400_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)): @@ -606,6 +607,7 @@ def begin_put_non_retry400( _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) @@ -660,9 +662,10 @@ def _put_non_retry201_creating400_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)): @@ -757,6 +760,7 @@ def begin_put_non_retry201_creating400( _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) @@ -811,9 +815,10 @@ def _put_non_retry201_creating400_invalid_json_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[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)): @@ -908,6 +913,7 @@ def begin_put_non_retry201_creating400_invalid_json( # 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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -962,9 +968,10 @@ def _put_async_relative_retry400_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)): @@ -1066,6 +1073,7 @@ def begin_put_async_relative_retry400( _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) @@ -1396,9 +1404,10 @@ def _post_non_retry400_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)): @@ -1494,6 +1503,7 @@ def begin_post_non_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1544,9 +1554,10 @@ def _post202_non_retry400_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)): @@ -1642,6 +1653,7 @@ def begin_post202_non_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1692,9 +1704,10 @@ def _post_async_relative_retry400_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)): @@ -1796,6 +1809,7 @@ def begin_post_async_relative_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1846,9 +1860,10 @@ def _put_error201_no_provisioning_state_payload_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[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)): @@ -1940,6 +1955,7 @@ def begin_put_error201_no_provisioning_state_payload( # pylint: disable=name-to _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) @@ -1994,9 +2010,10 @@ def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-lon _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)): @@ -2101,6 +2118,7 @@ def begin_put_async_relative_retry_no_status( _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) @@ -2163,9 +2181,10 @@ def _put_async_relative_retry_no_status_payload_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[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)): @@ -2270,6 +2289,7 @@ def begin_put_async_relative_retry_no_status_payload( # pylint: disable=name-to _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) @@ -2512,9 +2532,10 @@ def _post202_no_location_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)): @@ -2613,6 +2634,7 @@ def begin_post202_no_location( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2663,9 +2685,10 @@ def _post_async_relative_retry_no_payload_initial( # pylint: disable=name-too-l _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)): @@ -2770,6 +2793,7 @@ def begin_post_async_relative_retry_no_payload( # pylint: disable=name-too-long _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2820,9 +2844,10 @@ def _put200_invalid_json_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)): @@ -2917,6 +2942,7 @@ def begin_put200_invalid_json( _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) @@ -2971,9 +2997,10 @@ def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-to _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)): @@ -3078,6 +3105,7 @@ def begin_put_async_relative_retry_invalid_header( # pylint: disable=name-too-l _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) @@ -3140,9 +3168,10 @@ def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=n _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)): @@ -3247,6 +3276,7 @@ def begin_put_async_relative_retry_invalid_json_polling( # 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[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3590,9 +3620,10 @@ def _post202_retry_invalid_header_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)): @@ -3691,6 +3722,7 @@ def begin_post202_retry_invalid_header( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3741,9 +3773,10 @@ def _post_async_relative_retry_invalid_header_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[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)): @@ -3848,6 +3881,7 @@ def begin_post_async_relative_retry_invalid_header( # 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3898,9 +3932,10 @@ def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable= _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)): @@ -4005,6 +4040,7 @@ def begin_post_async_relative_retry_invalid_json_polling( # pylint: disable=nam _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py index 95357731d62..d595b8f93fe 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py @@ -154,9 +154,10 @@ async def _put200_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)): @@ -334,6 +335,7 @@ async def begin_put200_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -390,9 +392,10 @@ async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-to _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)): @@ -575,6 +578,7 @@ async def begin_patch200_succeeded_ignore_headers( _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) @@ -636,9 +640,10 @@ async def _patch201_retry_with_async_header_initial( # 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[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)): @@ -819,6 +824,7 @@ async def begin_patch201_retry_with_async_header( _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) @@ -875,9 +881,10 @@ async def _patch202_retry_with_async_and_location_header_initial( # pylint: dis _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)): @@ -1062,6 +1069,7 @@ async def begin_patch202_retry_with_async_and_location_header( # pylint: disabl _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) @@ -1118,9 +1126,10 @@ async def _put201_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)): @@ -1298,6 +1307,7 @@ async def begin_put201_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1473,9 +1483,10 @@ async def _put200_succeeded_no_state_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)): @@ -1653,6 +1664,7 @@ async def begin_put200_succeeded_no_state( _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) @@ -1709,9 +1721,10 @@ async def _put202_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)): @@ -1892,6 +1905,7 @@ async def begin_put202_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1948,9 +1962,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)): @@ -2131,6 +2146,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2187,9 +2203,10 @@ async def _put200_updating_succeeded204_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)): @@ -2370,6 +2387,7 @@ async def begin_put200_updating_succeeded204( _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) @@ -2426,9 +2444,10 @@ async def _put201_creating_failed200_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)): @@ -2609,6 +2628,7 @@ async def begin_put201_creating_failed200( _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) @@ -2665,9 +2685,10 @@ async def _put200_acceptedcanceled200_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)): @@ -2848,6 +2869,7 @@ async def begin_put200_acceptedcanceled200( _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) @@ -2904,9 +2926,10 @@ async def _put_no_header_in_retry_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)): @@ -3087,6 +3110,7 @@ async def begin_put_no_header_in_retry( _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) @@ -3146,9 +3170,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)): @@ -3336,6 +3361,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3399,9 +3425,10 @@ async def _put_async_no_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)): @@ -3588,6 +3615,7 @@ async def begin_put_async_no_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3650,9 +3678,10 @@ async def _put_async_retry_failed_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)): @@ -3840,6 +3869,7 @@ async def begin_put_async_retry_failed( _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) @@ -3903,9 +3933,10 @@ async def _put_async_no_retrycanceled_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)): @@ -4092,6 +4123,7 @@ async def begin_put_async_no_retrycanceled( _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) @@ -4154,9 +4186,10 @@ async def _put_async_no_header_in_retry_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)): @@ -4342,6 +4375,7 @@ async def begin_put_async_no_header_in_retry( _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) @@ -4403,9 +4437,10 @@ async def _put_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -4534,6 +4569,7 @@ async def begin_put_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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) @@ -4585,9 +4621,10 @@ async def _put_async_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -4716,6 +4753,7 @@ async def begin_put_async_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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) @@ -4767,9 +4805,10 @@ async def _put_sub_resource_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)): @@ -4914,6 +4953,7 @@ async def begin_put_sub_resource( _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) @@ -4970,9 +5010,10 @@ async def _put_async_sub_resource_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)): @@ -5117,6 +5158,7 @@ async def begin_put_async_sub_resource( _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) @@ -6475,9 +6517,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)): @@ -6611,6 +6654,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) @@ -6661,9 +6705,10 @@ async def _post202_no_retry204_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)): @@ -6845,6 +6890,7 @@ async def begin_post202_no_retry204( _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) @@ -7249,9 +7295,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)): @@ -7440,6 +7487,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -7496,9 +7544,10 @@ async def _post_async_no_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)): @@ -7687,6 +7736,7 @@ async def begin_post_async_no_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -7743,9 +7793,10 @@ async def _post_async_retry_failed_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)): @@ -7885,6 +7936,7 @@ async def begin_post_async_retry_failed( _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) @@ -7935,9 +7987,10 @@ async def _post_async_retrycanceled_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)): @@ -8077,6 +8130,7 @@ async def begin_post_async_retrycanceled( _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) @@ -8147,9 +8201,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)): @@ -8330,6 +8385,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -8386,9 +8442,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)): @@ -8576,6 +8633,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -8940,9 +8998,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)): @@ -9076,6 +9135,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) @@ -9126,9 +9186,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)): @@ -9268,6 +9329,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) @@ -9338,9 +9400,10 @@ async def _put_non_retry400_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)): @@ -9515,6 +9578,7 @@ async def begin_put_non_retry400( _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) @@ -9571,9 +9635,10 @@ async def _put_non_retry201_creating400_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)): @@ -9751,6 +9816,7 @@ async def begin_put_non_retry201_creating400( _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) @@ -9807,9 +9873,10 @@ async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable _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)): @@ -9987,6 +10054,7 @@ async def begin_put_non_retry201_creating400_invalid_json( # pylint: disable=na _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) @@ -10043,9 +10111,10 @@ async def _put_async_relative_retry400_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)): @@ -10230,6 +10299,7 @@ async def begin_put_async_relative_retry400( _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) @@ -10558,9 +10628,10 @@ async def _post_non_retry400_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)): @@ -10691,6 +10762,7 @@ async def begin_post_non_retry400( _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) @@ -10741,9 +10813,10 @@ async def _post202_non_retry400_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)): @@ -10874,6 +10947,7 @@ async def begin_post202_non_retry400( _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) @@ -10924,9 +10998,10 @@ async def _post_async_relative_retry400_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)): @@ -11063,6 +11138,7 @@ async def begin_post_async_relative_retry400( _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) @@ -11113,9 +11189,10 @@ async def _put_error201_no_provisioning_state_payload_initial( # pylint: disabl _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)): @@ -11290,6 +11367,7 @@ async def begin_put_error201_no_provisioning_state_payload( # pylint: disable=n _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) @@ -11346,9 +11424,10 @@ async def _put_async_relative_retry_no_status_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)): @@ -11536,6 +11615,7 @@ async def begin_put_async_relative_retry_no_status( _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) @@ -11599,9 +11679,10 @@ async def _put_async_relative_retry_no_status_payload_initial( # pylint: disabl _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)): @@ -11789,6 +11870,7 @@ async def begin_put_async_relative_retry_no_status_payload( # pylint: disable=n _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) @@ -12030,9 +12112,10 @@ async def _post202_no_location_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)): @@ -12166,6 +12249,7 @@ async def begin_post202_no_location( _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) @@ -12216,9 +12300,10 @@ async def _post_async_relative_retry_no_payload_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)): @@ -12358,6 +12443,7 @@ async def begin_post_async_relative_retry_no_payload( # pylint: disable=name-to _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) @@ -12408,9 +12494,10 @@ async def _put200_invalid_json_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)): @@ -12588,6 +12675,7 @@ async def begin_put200_invalid_json( _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) @@ -12644,9 +12732,10 @@ async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=n _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)): @@ -12834,6 +12923,7 @@ async def begin_put_async_relative_retry_invalid_header( # 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -12897,9 +12987,10 @@ async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: dis _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)): @@ -13087,6 +13178,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( # pylint: disabl _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) @@ -13428,9 +13520,10 @@ async def _post202_retry_invalid_header_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)): @@ -13564,6 +13657,7 @@ async def begin_post202_retry_invalid_header( _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) @@ -13614,9 +13708,10 @@ async def _post_async_relative_retry_invalid_header_initial( # pylint: disable= _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)): @@ -13756,6 +13851,7 @@ async def begin_post_async_relative_retry_invalid_header( # pylint: disable=nam _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) @@ -13806,9 +13902,10 @@ async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: di _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)): @@ -13948,6 +14045,7 @@ async def begin_post_async_relative_retry_invalid_json_polling( # pylint: disab _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) @@ -14018,9 +14116,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)): @@ -14211,6 +14310,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14274,9 +14374,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)): @@ -14460,6 +14561,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[JSON] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14516,9 +14618,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)): @@ -14655,6 +14758,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) @@ -14705,9 +14809,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)): @@ -14850,6 +14955,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) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py index 0734c5b9745..5b5a9b1d0a9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py @@ -1421,9 +1421,10 @@ def _put200_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[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)): @@ -1601,6 +1602,7 @@ def begin_put200_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1657,9 +1659,10 @@ def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long _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)): @@ -1842,6 +1845,7 @@ def begin_patch200_succeeded_ignore_headers( _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) @@ -1903,9 +1907,10 @@ def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long _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)): @@ -2086,6 +2091,7 @@ def begin_patch201_retry_with_async_header( _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) @@ -2142,9 +2148,10 @@ def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=n _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)): @@ -2329,6 +2336,7 @@ def begin_patch202_retry_with_async_and_location_header( # 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2385,9 +2393,10 @@ def _put201_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[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)): @@ -2565,6 +2574,7 @@ def begin_put201_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -2736,9 +2746,10 @@ def _put200_succeeded_no_state_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)): @@ -2916,6 +2927,7 @@ def begin_put200_succeeded_no_state( _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) @@ -2972,9 +2984,10 @@ def _put202_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[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)): @@ -3153,6 +3166,7 @@ def begin_put202_retry200(self, product: Optional[Union[JSON, IO[bytes]]] = None _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) @@ -3209,9 +3223,10 @@ 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[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)): @@ -3392,6 +3407,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -3448,9 +3464,10 @@ def _put200_updating_succeeded204_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)): @@ -3631,6 +3648,7 @@ def begin_put200_updating_succeeded204( _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) @@ -3687,9 +3705,10 @@ def _put201_creating_failed200_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)): @@ -3870,6 +3889,7 @@ def begin_put201_creating_failed200( _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) @@ -3926,9 +3946,10 @@ def _put200_acceptedcanceled200_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)): @@ -4109,6 +4130,7 @@ def begin_put200_acceptedcanceled200( _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) @@ -4165,9 +4187,10 @@ def _put_no_header_in_retry_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)): @@ -4348,6 +4371,7 @@ def begin_put_no_header_in_retry( _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) @@ -4407,9 +4431,10 @@ 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[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)): @@ -4597,6 +4622,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4660,9 +4686,10 @@ def _put_async_no_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[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)): @@ -4849,6 +4876,7 @@ def begin_put_async_no_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -4911,9 +4939,10 @@ def _put_async_retry_failed_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)): @@ -5101,6 +5130,7 @@ def begin_put_async_retry_failed( _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) @@ -5164,9 +5194,10 @@ def _put_async_no_retrycanceled_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)): @@ -5353,6 +5384,7 @@ def begin_put_async_no_retrycanceled( _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) @@ -5415,9 +5447,10 @@ def _put_async_no_header_in_retry_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)): @@ -5603,6 +5636,7 @@ def begin_put_async_no_header_in_retry( _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) @@ -5662,9 +5696,10 @@ def _put_non_resource_initial(self, sku: Optional[Union[JSON, IO[bytes]]] = None _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -5791,6 +5826,7 @@ def begin_put_non_resource(self, sku: Optional[Union[JSON, IO[bytes]]] = None, * _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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) @@ -5842,9 +5878,10 @@ def _put_async_non_resource_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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 sku else None _json = None _content = None if isinstance(sku, (IOBase, bytes)): @@ -5973,6 +6010,7 @@ def begin_put_async_non_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if sku 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) @@ -6024,9 +6062,10 @@ def _put_sub_resource_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)): @@ -6171,6 +6210,7 @@ def begin_put_sub_resource( _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) @@ -6227,9 +6267,10 @@ def _put_async_sub_resource_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)): @@ -6374,6 +6415,7 @@ def begin_put_async_sub_resource( _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) @@ -7732,9 +7774,10 @@ 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[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)): @@ -7868,6 +7911,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -7918,9 +7962,10 @@ def _post202_no_retry204_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)): @@ -8102,6 +8147,7 @@ def begin_post202_no_retry204( _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) @@ -8505,9 +8551,10 @@ 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[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)): @@ -8696,6 +8743,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -8752,9 +8800,10 @@ def _post_async_no_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[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)): @@ -8943,6 +8992,7 @@ def begin_post_async_no_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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -8999,9 +9049,10 @@ def _post_async_retry_failed_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)): @@ -9141,6 +9192,7 @@ def begin_post_async_retry_failed( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -9191,9 +9243,10 @@ def _post_async_retrycanceled_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)): @@ -9333,6 +9386,7 @@ def begin_post_async_retrycanceled( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -9403,9 +9457,10 @@ 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[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)): @@ -9586,6 +9641,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -9642,9 +9698,10 @@ def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lon _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)): @@ -9832,6 +9889,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -10196,9 +10254,10 @@ 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[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)): @@ -10332,6 +10391,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -10382,9 +10442,10 @@ def _post_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lo _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)): @@ -10524,6 +10585,7 @@ def begin_post_async_relative_retry_succeeded( # pylint: disable=name-too-long _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -10594,9 +10656,10 @@ def _put_non_retry400_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)): @@ -10771,6 +10834,7 @@ def begin_put_non_retry400( _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) @@ -10827,9 +10891,10 @@ def _put_non_retry201_creating400_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)): @@ -11007,6 +11072,7 @@ def begin_put_non_retry201_creating400( _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) @@ -11063,9 +11129,10 @@ def _put_non_retry201_creating400_invalid_json_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[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)): @@ -11243,6 +11310,7 @@ def begin_put_non_retry201_creating400_invalid_json( # 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -11299,9 +11367,10 @@ def _put_async_relative_retry400_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)): @@ -11486,6 +11555,7 @@ def begin_put_async_relative_retry400( _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) @@ -11814,9 +11884,10 @@ def _post_non_retry400_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)): @@ -11947,6 +12018,7 @@ def begin_post_non_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -11997,9 +12069,10 @@ def _post202_non_retry400_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)): @@ -12130,6 +12203,7 @@ def begin_post202_non_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -12180,9 +12254,10 @@ def _post_async_relative_retry400_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)): @@ -12319,6 +12394,7 @@ def begin_post_async_relative_retry400( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -12369,9 +12445,10 @@ def _put_error201_no_provisioning_state_payload_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[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)): @@ -12546,6 +12623,7 @@ def begin_put_error201_no_provisioning_state_payload( # pylint: disable=name-to _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) @@ -12602,9 +12680,10 @@ def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-lon _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)): @@ -12792,6 +12871,7 @@ def begin_put_async_relative_retry_no_status( _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) @@ -12855,9 +12935,10 @@ def _put_async_relative_retry_no_status_payload_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[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)): @@ -13045,6 +13126,7 @@ def begin_put_async_relative_retry_no_status_payload( # pylint: disable=name-to _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) @@ -13286,9 +13368,10 @@ def _post202_no_location_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)): @@ -13422,6 +13505,7 @@ def begin_post202_no_location( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -13472,9 +13556,10 @@ def _post_async_relative_retry_no_payload_initial( # pylint: disable=name-too-l _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)): @@ -13614,6 +13699,7 @@ def begin_post_async_relative_retry_no_payload( # pylint: disable=name-too-long _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -13664,9 +13750,10 @@ def _put200_invalid_json_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)): @@ -13844,6 +13931,7 @@ def begin_put200_invalid_json( _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) @@ -13900,9 +13988,10 @@ def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-to _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)): @@ -14090,6 +14179,7 @@ def begin_put_async_relative_retry_invalid_header( # pylint: disable=name-too-l _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) @@ -14153,9 +14243,10 @@ def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=n _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)): @@ -14343,6 +14434,7 @@ def begin_put_async_relative_retry_invalid_json_polling( # 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14684,9 +14776,10 @@ def _post202_retry_invalid_header_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)): @@ -14820,6 +14913,7 @@ def begin_post202_retry_invalid_header( _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -14870,9 +14964,10 @@ def _post_async_relative_retry_invalid_header_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[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)): @@ -15012,6 +15107,7 @@ def begin_post_async_relative_retry_invalid_header( # 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15062,9 +15158,10 @@ def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable= _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)): @@ -15204,6 +15301,7 @@ def begin_post_async_relative_retry_invalid_json_polling( # pylint: disable=nam _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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15274,9 +15372,10 @@ 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[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)): @@ -15467,6 +15566,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15530,9 +15630,10 @@ 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[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)): @@ -15716,6 +15817,7 @@ 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[JSON] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15772,9 +15874,10 @@ 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[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)): @@ -15911,6 +16014,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -15961,9 +16065,10 @@ 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[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)): @@ -16106,6 +16211,7 @@ 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, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py index f62d1ee5f99..35848887e41 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 46ae34565ab..8ac74a2838b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py index 84c3d3841b7..daa3735c2b4 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py index 2cb6597698e..bdb517eb316 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py index 40f3818e5ee..23e58c17f4f 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py index b107fe873a8..8b6cdb87fbb 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py index d929f8bf2d6..1a19641e3c0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index 557679c50c9..a6b99e5431d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py index 6038b3223f9..ac3fd628141 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py index 0e903fbf358..49ef77c6fe2 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py index 89976bf3ea7..26b78b905ab 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py index cd4d63afc93..94bd791a2d1 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py index e7acc80c0cf..f9eba0b6877 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py @@ -193,9 +193,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py index 242761a2b61..07a3bbe6a55 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py index 4de630b1cbc..b1fa726e075 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py index adbd04a93a0..6501e7cd15b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py index 78dabac6679..88dfd87a01c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py @@ -121,9 +121,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)): @@ -219,6 +220,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py index 515829ea494..42c244f79ef 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py @@ -200,9 +200,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)): @@ -295,6 +296,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py index 37b3540d142..e9b1fba3a59 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py @@ -110,9 +110,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py index db52e2cabf8..26f2e669f89 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py @@ -153,9 +153,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py index 4810e0d7a88..a72d3d18f45 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py @@ -191,9 +191,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py index 357af5d2bcd..f217821d1fe 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py @@ -109,6 +109,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 @@ -120,7 +121,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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py index 0de3bce040f..a5933ef9816 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py @@ -225,9 +225,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py index 7ec00e9343e..5c06bb41f3f 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py @@ -154,6 +154,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 @@ -165,7 +166,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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py index eb6b1c91320..85db2407b71 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py @@ -121,9 +121,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)): @@ -219,6 +220,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py index a95d32a500a..18a0474f857 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py @@ -200,9 +200,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)): @@ -295,6 +296,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py index 29b61c84d7d..86cdfddb628 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py @@ -110,9 +110,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py index f0bb45f34f8..2e66e1402a1 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py @@ -153,9 +153,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py index f8111fd393d..e00e20530f0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py @@ -191,9 +191,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py index 36a3a5d4aac..3bd7227a12c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py @@ -109,6 +109,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 @@ -120,7 +121,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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py index 58023a70161..3a216e9ed71 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py @@ -225,9 +225,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py index 1f129a41ba3..27e99a5b957 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py @@ -154,6 +154,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 @@ -165,7 +166,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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index fbd91630cb9..213e4dd40d4 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py index 989e7bd0329..07764776e39 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py index cd3e27b7e2a..1b698418913 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index 15674246d9b..c65b78dcc14 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py index 6355ac0bade..4b8264f3b84 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py @@ -121,9 +121,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)): @@ -219,6 +220,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py index 741e752ad66..634874100e9 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py @@ -200,9 +200,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)): @@ -295,6 +296,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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py index ed2abb12dca..e1188fe48c5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index 460e97d1d07..60f81a606bc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -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)): @@ -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) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py index fcd3097bafc..cd6d2541114 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py index 0b4f3f256ab..165fab2e9aa 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py index ef98d169b63..c4b2ad250aa 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py @@ -193,9 +193,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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py index f82398c6d8f..c0c69b9fb44 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py index e36defb01b5..a6dfd8e8062 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py @@ -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)): diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 0b0effb9e55..f39c37cefd3 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -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 @@ -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, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py index fda82b9cb5d..ee1deaa77eb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py @@ -131,7 +131,8 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if string_body else None cls: ClsType[None] = kwargs.pop("cls", None) if string_body is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py index ed17c1bb883..f5fe7d90a96 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py @@ -328,7 +328,8 @@ def put_null( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if string_body else None cls: ClsType[None] = kwargs.pop("cls", None) if string_body is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py index abeaf371ed3..68e285e6c39 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py @@ -153,9 +153,10 @@ async def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = Non _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if pet_param else None cls: ClsType[_models.Pet] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if pet_param else None _json = None _content = None if isinstance(pet_param, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py index ea1b69af117..778e2b96b14 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py @@ -191,9 +191,10 @@ def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = None, **k _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if pet_param else None cls: ClsType[_models.Pet] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if pet_param else None _json = None _content = None if isinstance(pet_param, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py index dc40330b4a7..d8393c89069 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py @@ -228,7 +228,8 @@ async def put400(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -281,7 +282,8 @@ async def patch400(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -334,7 +336,8 @@ async def post400(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -387,7 +390,8 @@ async def delete400(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -608,7 +612,8 @@ async def put404(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -661,7 +666,8 @@ async def patch405(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -714,7 +720,8 @@ async def post406(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -767,7 +774,8 @@ async def delete407(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -820,7 +828,8 @@ async def put409(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1041,7 +1050,8 @@ async def put413(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1094,7 +1104,8 @@ async def patch414(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1147,7 +1158,8 @@ async def post415(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1242,7 +1254,8 @@ async def delete417(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py index c63118efbee..839655616bf 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py @@ -281,7 +281,8 @@ async def put301(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -430,7 +431,8 @@ async def patch302(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -487,7 +489,8 @@ async def post303(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -682,7 +685,8 @@ async def put307(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -739,7 +743,8 @@ async def patch307(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -796,7 +801,8 @@ async def post307(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -853,7 +859,8 @@ async def delete307(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py index ed768fe5cf0..83066fa1a95 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py @@ -126,7 +126,8 @@ async def put500(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -179,7 +180,8 @@ async def patch500(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -320,7 +322,8 @@ async def post503(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -373,7 +376,8 @@ async def delete503(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -426,7 +430,8 @@ async def put504(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -479,7 +484,8 @@ async def patch504(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py index 85df71ca4b6..2aa2dbf9ad1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py @@ -163,7 +163,8 @@ async def post505(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -216,7 +217,8 @@ async def delete505(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py index f4e307f9093..b514b8da8d6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py @@ -229,7 +229,8 @@ async def put200(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -282,7 +283,8 @@ async def patch200(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -335,7 +337,8 @@ async def post200(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -388,7 +391,8 @@ async def delete200(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -441,7 +445,8 @@ async def put201(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -494,7 +499,8 @@ async def post201(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -547,7 +553,8 @@ async def put202(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -600,7 +607,8 @@ async def patch202(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -653,7 +661,8 @@ async def post202(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -706,7 +715,8 @@ async def delete202(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -801,7 +811,8 @@ async def put204(self, boolean_value: Literal[True] = True, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -854,7 +865,8 @@ async def patch204(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -907,7 +919,8 @@ async def post204(self, boolean_value: Literal[True] = True, **kwargs: Any) -> N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -960,7 +973,8 @@ async def delete204(self, boolean_value: Literal[True] = True, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py index a22b6ff0f52..01df57ea9b1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py @@ -608,7 +608,8 @@ def put400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -663,7 +664,8 @@ def patch400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -718,7 +720,8 @@ def post400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -773,7 +776,8 @@ def delete400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -996,7 +1000,8 @@ def put404( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1051,7 +1056,8 @@ def patch405( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1106,7 +1112,8 @@ def post406( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1161,7 +1168,8 @@ def delete407( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1216,7 +1224,8 @@ def put409( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1439,7 +1448,8 @@ def put413( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1494,7 +1504,8 @@ def patch414( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1549,7 +1560,8 @@ def post415( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1646,7 +1658,8 @@ def delete417( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py index 428a81ba271..3a34bf28b36 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py @@ -514,7 +514,8 @@ def put301( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -665,7 +666,8 @@ def patch302( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -724,7 +726,8 @@ def post303( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -921,7 +924,8 @@ def put307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -980,7 +984,8 @@ def patch307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1039,7 +1044,8 @@ def post307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1098,7 +1104,8 @@ def delete307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py index 1a9f39fccd5..1e2b307269e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py @@ -264,7 +264,8 @@ def put500( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -319,7 +320,8 @@ def patch500( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -462,7 +464,8 @@ def post503( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -517,7 +520,8 @@ def delete503( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -572,7 +576,8 @@ def put504( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -627,7 +632,8 @@ def patch504( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py index 3981ccd3bd5..9828b914f20 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py @@ -224,7 +224,8 @@ def post505( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -279,7 +280,8 @@ def delete505( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py index cc83255487f..210dde8f8f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py @@ -521,7 +521,8 @@ def put200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -576,7 +577,8 @@ def patch200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -631,7 +633,8 @@ def post200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -686,7 +689,8 @@ def delete200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -741,7 +745,8 @@ def put201( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -796,7 +801,8 @@ def post201( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -851,7 +857,8 @@ def put202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -906,7 +913,8 @@ def patch202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -961,7 +969,8 @@ def post202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1016,7 +1025,8 @@ def delete202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1113,7 +1123,8 @@ def put204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1168,7 +1179,8 @@ def patch204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1223,7 +1235,8 @@ def post204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1278,7 +1291,8 @@ def delete204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py index 49ba3228c04..1629156b6e4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py @@ -101,6 +101,7 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -112,7 +113,7 @@ async def analyze_body(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_analyze_body_request( content_type=content_type, @@ -202,6 +203,7 @@ async def analyze_body_no_accept_header( _params = kwargs.pop("params", {}) or {} 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 @@ -213,7 +215,7 @@ async def analyze_body_no_accept_header( _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_analyze_body_no_accept_header_request( content_type=content_type, @@ -260,6 +262,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py index ed5ec5f5268..c0dad3aac91 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py @@ -215,6 +215,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -226,7 +227,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N _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_analyze_body_request( content_type=content_type, @@ -316,6 +317,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} 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 @@ -327,7 +329,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _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_analyze_body_no_accept_header_request( content_type=content_type, @@ -374,6 +376,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index bf346c2f8a6..235cf4ff27c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -101,6 +101,7 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -112,7 +113,7 @@ async def analyze_body(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_analyze_body_request( content_type=content_type, @@ -202,6 +203,7 @@ async def analyze_body_no_accept_header( _params = kwargs.pop("params", {}) or {} 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 @@ -213,7 +215,7 @@ async def analyze_body_no_accept_header( _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_analyze_body_no_accept_header_request( content_type=content_type, @@ -260,6 +262,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index b7c3fb09922..bcdf36c86e1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -215,6 +215,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -226,7 +227,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N _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_analyze_body_request( content_type=content_type, @@ -316,6 +317,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} 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 @@ -327,7 +329,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _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_analyze_body_no_accept_header_request( content_type=content_type, @@ -374,6 +376,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py index 49192e3f52d..1877f4cdeb0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -121,9 +121,10 @@ async def put_array( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -280,9 +281,10 @@ async def put_wrapped_array( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -437,9 +439,10 @@ async def put_dictionary( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_dictionary else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_dictionary else None _json = None _content = None if isinstance(resource_dictionary, (IOBase, bytes)): @@ -599,9 +602,10 @@ async def put_resource_collection( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_complex_object else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_complex_object else None _json = None _content = None if isinstance(resource_complex_object, (IOBase, bytes)): @@ -755,9 +759,10 @@ async def put_simple_product( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[_models.SimpleProduct] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py index 4b1fc1bf58e..66ff660615f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -292,9 +292,10 @@ def put_array( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -451,9 +452,10 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -608,9 +610,10 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_dictionary else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_dictionary else None _json = None _content = None if isinstance(resource_dictionary, (IOBase, bytes)): @@ -770,9 +773,10 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_complex_object else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_complex_object else None _json = None _content = None if isinstance(resource_complex_object, (IOBase, bytes)): @@ -926,9 +930,10 @@ def put_simple_product( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[_models.SimpleProduct] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py index 2a43288f3e8..13b0a30672e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py @@ -70,7 +70,8 @@ async def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py index 0d4ac168f77..8a346697b29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py @@ -70,7 +70,8 @@ async def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py index 7aa23a229ca..c17084b2ae9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py @@ -103,7 +103,8 @@ def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py index e702fd15e9f..962ec2f74e0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py @@ -103,7 +103,8 @@ def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py index 0ff01136fd1..cdbf75f36ff 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py @@ -101,7 +101,10 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO[bytes]] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -249,7 +252,8 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -546,7 +550,8 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -921,9 +926,10 @@ async def post_optional_class_parameter( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1209,9 +1215,10 @@ async def post_optional_array_parameter( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py index 125a2bbb8cb..391a4783715 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py @@ -218,7 +218,8 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -270,7 +271,10 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO[bytes]] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py index 3f664af616d..04477c57850 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py @@ -496,7 +496,10 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -650,7 +653,8 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -959,7 +963,8 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -1342,9 +1347,10 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1636,9 +1642,10 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py index 43437c0e0fd..39760b4bf10 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py @@ -364,7 +364,8 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -418,7 +419,10 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py index b66856f540f..bb26033b462 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py @@ -184,9 +184,10 @@ async def validation_of_body( api_version: str = kwargs.pop("api_version", _params.pop("apiVersion", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.Product] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): @@ -329,9 +330,10 @@ async def post_with_constant_in_body( constant_param: Literal["constant"] = kwargs.pop("constant_param", "constant") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.Product] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py index 9e614a2cf7b..b7e32110c93 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py @@ -278,9 +278,10 @@ def validation_of_body( api_version: str = kwargs.pop("api_version", _params.pop("apiVersion", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.Product] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): @@ -423,9 +424,10 @@ def post_with_constant_in_body( constant_param: Literal["constant"] = kwargs.pop("constant_param", "constant") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.Product] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py index 640112131a0..4c99d1d8ffb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py @@ -139,7 +139,8 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if string_body else None cls: ClsType[None] = kwargs.pop("cls", None) if string_body is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py index f7bc5b7c452..1c0b3af07a0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py @@ -425,7 +425,8 @@ def put_null( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if string_body else None cls: ClsType[None] = kwargs.pop("cls", None) if string_body is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py index 0fe88bf6ec2..3d95f74201c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py @@ -208,9 +208,10 @@ async def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kw _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if pet_param else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if pet_param else None _json = None _content = None if isinstance(pet_param, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py index 7a93daaae34..c19d78e6b7c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py @@ -246,9 +246,10 @@ def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if pet_param else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if pet_param else None _json = None _content = None if isinstance(pet_param, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py index 7f7f58ba6f7..0fc19e04734 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py @@ -486,7 +486,8 @@ async def put200(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -538,7 +539,8 @@ async def patch200(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -590,7 +592,8 @@ async def post200(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -642,7 +645,8 @@ async def delete200(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -694,7 +698,8 @@ async def put201(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -746,7 +751,8 @@ async def post201(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -798,7 +804,8 @@ async def put202(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -850,7 +857,8 @@ async def patch202(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -902,7 +910,8 @@ async def post202(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -954,7 +963,8 @@ async def delete202(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1047,7 +1057,8 @@ async def put204(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1099,7 +1110,8 @@ async def patch204(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1151,7 +1163,8 @@ async def post204(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1203,7 +1216,8 @@ async def delete204(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1513,7 +1527,8 @@ async def put301(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1659,7 +1674,8 @@ async def patch302(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1715,7 +1731,8 @@ async def post303(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1906,7 +1923,8 @@ async def put307(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -1962,7 +1980,8 @@ async def patch307(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2018,7 +2037,8 @@ async def post307(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2074,7 +2094,8 @@ async def delete307(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2273,7 +2294,8 @@ async def put400(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2325,7 +2347,8 @@ async def patch400(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2377,7 +2400,8 @@ async def post400(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2429,7 +2453,8 @@ async def delete400(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2645,7 +2670,8 @@ async def put404(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2697,7 +2723,8 @@ async def patch405(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2749,7 +2776,8 @@ async def post406(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2801,7 +2829,8 @@ async def delete407(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2853,7 +2882,8 @@ async def put409(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3069,7 +3099,8 @@ async def put413(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3121,7 +3152,8 @@ async def patch414(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3173,7 +3205,8 @@ async def post415(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3266,7 +3299,8 @@ async def delete417(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3461,7 +3495,8 @@ async def post505(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3513,7 +3548,8 @@ async def delete505(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3626,7 +3662,8 @@ async def put500(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3678,7 +3715,8 @@ async def patch500(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3819,7 +3857,8 @@ async def post503(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3871,7 +3910,8 @@ async def delete503(self, boolean_value: Optional[Literal[True]] = None, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3923,7 +3963,8 @@ async def put504(self, boolean_value: Optional[Literal[True]] = None, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3975,7 +4016,8 @@ async def patch504(self, boolean_value: Optional[Literal[True]] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py index e8dc3c3bb13..a2b57feb2f5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py @@ -2092,7 +2092,8 @@ def put200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2146,7 +2147,8 @@ def patch200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2200,7 +2202,8 @@ def post200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2254,7 +2257,8 @@ def delete200( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2308,7 +2312,8 @@ def put201( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2362,7 +2367,8 @@ def post201( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2416,7 +2422,8 @@ def put202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2470,7 +2477,8 @@ def patch202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2524,7 +2532,8 @@ def post202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2578,7 +2587,8 @@ def delete202( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2673,7 +2683,8 @@ def put204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2727,7 +2738,8 @@ def patch204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2781,7 +2793,8 @@ def post204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -2835,7 +2848,8 @@ def delete204( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3147,7 +3161,8 @@ def put301( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3295,7 +3310,8 @@ def patch302( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3353,7 +3369,8 @@ def post303( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3546,7 +3563,8 @@ def put307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3604,7 +3622,8 @@ def patch307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3662,7 +3681,8 @@ def post307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3720,7 +3740,8 @@ def delete307( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3921,7 +3942,8 @@ def put400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -3975,7 +3997,8 @@ def patch400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4029,7 +4052,8 @@ def post400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4083,7 +4107,8 @@ def delete400( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4301,7 +4326,8 @@ def put404( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4355,7 +4381,8 @@ def patch405( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4409,7 +4436,8 @@ def post406( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4463,7 +4491,8 @@ def delete407( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4517,7 +4546,8 @@ def put409( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4735,7 +4765,8 @@ def put413( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4789,7 +4820,8 @@ def patch414( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4843,7 +4875,8 @@ def post415( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -4938,7 +4971,8 @@ def delete417( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5135,7 +5169,8 @@ def post505( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5189,7 +5224,8 @@ def delete505( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5304,7 +5340,8 @@ def put500( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5358,7 +5395,8 @@ def patch500( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5501,7 +5539,8 @@ def post503( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5555,7 +5594,8 @@ def delete503( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5609,7 +5649,8 @@ def put504( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: @@ -5663,7 +5704,8 @@ def patch504( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if boolean_value else None cls: ClsType[None] = kwargs.pop("cls", None) if boolean_value is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py index 7b56185938a..572210cf201 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py @@ -226,6 +226,7 @@ def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -242,7 +243,7 @@ def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: _json = input else: _json = None - content_type = content_type or "application/json" + content_type = content_type or "application/json" if input else None _request = build_media_types_analyze_body_request( content_type=content_type, @@ -351,6 +352,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} 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 @@ -367,7 +369,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem _json = input else: _json = None - content_type = content_type or "application/json" + content_type = content_type or "application/json" if input else None _request = build_media_types_analyze_body_no_accept_header_request( content_type=content_type, @@ -414,6 +416,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py index a35a45cd205..1feba5ccfeb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py @@ -122,6 +122,7 @@ async def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **k _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) _json = None @@ -138,7 +139,7 @@ async def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **k _json = input else: _json = None - content_type = content_type or "application/json" + content_type = content_type or "application/json" if input else None _request = build_media_types_analyze_body_request( content_type=content_type, @@ -247,6 +248,7 @@ async def analyze_body_no_accept_header( _params = kwargs.pop("params", {}) or {} 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 @@ -263,7 +265,7 @@ async def analyze_body_no_accept_header( _json = input else: _json = None - content_type = content_type or "application/json" + content_type = content_type or "application/json" if input else None _request = build_media_types_analyze_body_no_accept_header_request( content_type=content_type, @@ -310,6 +312,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py index 276bb710ae0..e1cec31df20 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py @@ -324,9 +324,10 @@ def put_array( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -512,9 +513,10 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -704,9 +706,10 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_dictionary else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_dictionary else None _json = None _content = None if isinstance(resource_dictionary, (IOBase, bytes)): @@ -997,9 +1000,10 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_complex_object else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_complex_object else None _json = None _content = None if isinstance(resource_complex_object, (IOBase, bytes)): @@ -1283,9 +1287,10 @@ def put_simple_product(self, simple_body_product: Optional[Union[JSON, IO[bytes] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): @@ -1471,9 +1476,10 @@ def post_flattened_simple_product( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): @@ -1675,9 +1681,10 @@ def put_simple_product_with_grouping( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py index 5b53ad49c43..7984761b20a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py @@ -131,9 +131,10 @@ async def put_array(self, resource_array: Optional[Union[List[JSON], IO[bytes]]] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -319,9 +320,10 @@ async def put_wrapped_array( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_array else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_array else None _json = None _content = None if isinstance(resource_array, (IOBase, bytes)): @@ -511,9 +513,10 @@ async def put_dictionary( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_dictionary else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_dictionary else None _json = None _content = None if isinstance(resource_dictionary, (IOBase, bytes)): @@ -804,9 +807,10 @@ async def put_resource_collection( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if resource_complex_object else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if resource_complex_object else None _json = None _content = None if isinstance(resource_complex_object, (IOBase, bytes)): @@ -1092,9 +1096,10 @@ async def put_simple_product( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): @@ -1280,9 +1285,10 @@ async def post_flattened_simple_product( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): @@ -1484,9 +1490,10 @@ async def put_simple_product_with_grouping( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if simple_body_product else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if simple_body_product else None _json = None _content = None if isinstance(simple_body_product, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py index 0aefa6f3bb2..35acf6d2d17 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py @@ -74,7 +74,8 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: @@ -199,7 +200,8 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py index e656d272cb2..3345e47af7a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py @@ -133,7 +133,8 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: @@ -258,7 +259,8 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if input else None cls: ClsType[str] = kwargs.pop("cls", None) if input is not None: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py index decb4f3df69..6fdc23f71d5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py @@ -238,7 +238,8 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -289,7 +290,10 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO[bytes]] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -483,7 +487,10 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO[bytes]] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -628,7 +635,8 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -836,9 +844,10 @@ async def post_optional_integer_property( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1031,7 +1040,8 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -1239,9 +1249,10 @@ async def post_optional_string_property( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1546,9 +1557,10 @@ async def post_optional_class_parameter( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1772,9 +1784,10 @@ async def post_optional_class_property( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1970,9 +1983,10 @@ async def post_optional_array_parameter( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -2192,9 +2206,10 @@ async def post_optional_array_property( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py index 66ed3a63cfe..b24b2122322 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py @@ -798,7 +798,8 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -851,7 +852,10 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -1047,7 +1051,10 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", "application/octet-stream") + ) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) _content = body_parameter @@ -1198,7 +1205,8 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -1408,9 +1416,10 @@ def post_optional_integer_property( # pylint: disable=inconsistent-return-state _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -1611,7 +1620,8 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) if body_parameter is not None: @@ -1821,9 +1831,10 @@ def post_optional_string_property( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -2134,9 +2145,10 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -2362,9 +2374,10 @@ def post_optional_class_property( # pylint: disable=inconsistent-return-stateme _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -2562,9 +2575,10 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): @@ -2786,9 +2800,10 @@ def post_optional_array_property( # pylint: disable=inconsistent-return-stateme _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body_parameter else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body_parameter else None _json = None _content = None if isinstance(body_parameter, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py index 410ca0359ab..c02a0375099 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py @@ -414,9 +414,10 @@ def validation_of_body( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): @@ -668,9 +669,10 @@ def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]]] = No constant_param: Literal["constant"] = kwargs.pop("constant_param", "constant") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py index d122d1080cb..3554cbf015d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py @@ -314,9 +314,10 @@ async def validation_of_body( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): @@ -568,9 +569,10 @@ async def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]] constant_param: Literal["constant"] = kwargs.pop("constant_param", "constant") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[JSON] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _json = None _content = None if isinstance(body, (IOBase, bytes)): diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index c2d82df8252..51855b60b40 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -67,7 +67,7 @@ "js-yaml": "~4.1.0", "semver": "~7.6.2", "tsx": "~4.19.1", - "@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", "fs-extra": "~11.2.0" }, "devDependencies": { @@ -103,4 +103,4 @@ "chalk": "5.3.0", "@types/fs-extra": "11.0.4" } -} +} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_operations.py index f26a8b4925f..2551ac501d4 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_operations.py @@ -1243,9 +1243,10 @@ async def patch( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if properties else None cls: ClsType[_models.Widget] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if properties else None _content = None if isinstance(properties, (IOBase, bytes)): _content = properties @@ -1412,9 +1413,10 @@ async def post( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.ActionResult] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -1544,9 +1546,10 @@ async def provider_post( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.ChangeAllowanceResult] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_operations.py index 091b6be15a1..8b462c78f35 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_operations.py @@ -1510,9 +1510,10 @@ def patch( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if properties else None cls: ClsType[_models.Widget] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if properties else None _content = None if isinstance(properties, (IOBase, bytes)): _content = properties @@ -1679,9 +1680,10 @@ def post( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.ActionResult] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -1811,9 +1813,10 @@ def provider_post( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[_models.ChangeAllowanceResult] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py index 975d83a41c9..cb09904da99 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py @@ -120,9 +120,10 @@ async def set(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] = _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -225,9 +226,10 @@ async def omit(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py index 649652306b8..adc67ed5407 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py @@ -150,9 +150,10 @@ def set( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -255,9 +256,10 @@ def omit( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py index 7ab1942cc84..288003e6ff4 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py @@ -404,9 +404,10 @@ def update_optional_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + content_type = content_type if body else None cls: ClsType[_models.Resource] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/merge-patch+json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py index 983828a683e..66bf35efc70 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py @@ -357,9 +357,10 @@ async def update_optional_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + content_type = content_type if body else None cls: ClsType[_models.Resource] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/merge-patch+json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py index 5f14765fdd3..e1852adb561 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py @@ -112,9 +112,10 @@ async def set(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] = _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -214,9 +215,10 @@ async def omit(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py index 4b5ae3216ec..057a0c53478 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py @@ -142,9 +142,10 @@ def set( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -244,9 +245,10 @@ def omit( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py index 00e39a15e7e..08b91ad2399 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py @@ -390,9 +390,10 @@ def update_optional_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + content_type = content_type if body else None cls: ClsType[_models.Resource] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/merge-patch+json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py index cde1a81d0ba..82c168cd1f8 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py @@ -346,9 +346,10 @@ async def update_optional_resource( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + content_type = content_type if body else None cls: ClsType[_models.Resource] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/merge-patch+json" if body else None _content = None if isinstance(body, (IOBase, bytes)): _content = body diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b11217d5e6f..38834a48447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: 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 - version: 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(6gtvfxfythggrmyik6oqzxhslm) + specifier: 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 + version: 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(6gtvfxfythggrmyik6oqzxhslm) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -82,8 +82,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: 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 - version: 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(6gtvfxfythggrmyik6oqzxhslm) + specifier: 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 + version: 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(6gtvfxfythggrmyik6oqzxhslm) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -1677,8 +1677,8 @@ packages: peerDependencies: '@typespec/compiler': ^1.3.0 - '@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': - resolution: {tarball: 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': + resolution: {tarball: 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} version: 0.15.2 engines: {node: '>=20.0.0'} peerDependencies: @@ -6460,7 +6460,7 @@ snapshots: dependencies: '@typespec/compiler': 1.3.0(@types/node@24.1.0) - '@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(6gtvfxfythggrmyik6oqzxhslm)': + '@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(6gtvfxfythggrmyik6oqzxhslm)': dependencies: '@azure-tools/typespec-autorest': 0.59.0(tlfj6gbglsbr5x2lirzpm33h7y) '@azure-tools/typespec-azure-core': 0.59.0(@typespec/compiler@1.3.0(@types/node@24.1.0))(@typespec/http@1.3.0(@typespec/compiler@1.3.0(@types/node@24.1.0))(@typespec/streams@0.73.0(@typespec/compiler@1.3.0(@types/node@24.1.0))))(@typespec/rest@0.73.0(@typespec/compiler@1.3.0(@types/node@24.1.0))(@typespec/http@1.3.0(@typespec/compiler@1.3.0(@types/node@24.1.0))(@typespec/streams@0.73.0(@typespec/compiler@1.3.0(@types/node@24.1.0)))))