From 5a3bc340df932072f881cc69b95f8ff37c3cc877 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:59:36 -0400 Subject: [PATCH] add back response.read() check for all operations (#2658) --- .../stream_reading-2024-5-25-18-18-57.md | 8 + .../codegen/serializers/builder_serializer.py | 11 +- .../sample/aio/operations/_operations.py | 6 + .../sample/operations/_operations.py | 6 + .../sample/aio/operations/_operations.py | 6 + .../basic/sample/operations/_operations.py | 6 + .../sample/_operations/_operations.py | 5 +- .../sample/aio/_operations/_operations.py | 5 +- .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../aio/operations/_duration_operations.py | 8 + .../operations/_duration_operations.py | 8 + .../_parameter_grouping_operations.py | 12 + .../_parameter_grouping_operations.py | 12 + ...est_report_service_for_azure_operations.py | 2 + ...est_report_service_for_azure_operations.py | 2 + .../_api_version_default_operations.py | 8 + .../_api_version_local_operations.py | 8 + .../aio/operations/_header_operations.py | 6 + .../aio/operations/_odata_operations.py | 2 + .../_skip_url_encoding_operations.py | 14 + ..._subscription_in_credentials_operations.py | 10 + .../_subscription_in_method_operations.py | 8 + .../_xms_client_request_id_operations.py | 4 + .../_api_version_default_operations.py | 8 + .../_api_version_local_operations.py | 8 + .../operations/_header_operations.py | 6 + .../operations/_odata_operations.py | 2 + .../_skip_url_encoding_operations.py | 14 + ..._subscription_in_credentials_operations.py | 10 + .../_subscription_in_method_operations.py | 8 + .../_xms_client_request_id_operations.py | 4 + .../aio/operations/_paths_operations.py | 2 + .../operations/_paths_operations.py | 2 + .../aio/operations/_paging_operations.py | 49 +++- .../operations/_paging_operations.py | 49 +++- .../aio/operations/_paging_operations.py | 4 + .../operations/_paging_operations.py | 4 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_head_exception_operations.py | 6 + .../operations/_head_exception_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../_lr_os_custom_header_operations.py | 12 +- .../aio/operations/_lro_retrys_operations.py | 21 +- .../lro/aio/operations/_lros_operations.py | 132 ++++++---- .../lro/aio/operations/_lrosads_operations.py | 78 ++++-- .../_lr_os_custom_header_operations.py | 12 +- .../lro/operations/_lro_retrys_operations.py | 21 +- .../Lro/lro/operations/_lros_operations.py | 132 ++++++---- .../Lro/lro/operations/_lrosads_operations.py | 78 ++++-- ...with_paramaterized_endpoints_operations.py | 6 +- ...with_paramaterized_endpoints_operations.py | 6 +- .../_api_version_default_operations.py | 8 + .../_api_version_local_operations.py | 8 + .../aio/operations/_header_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../aio/operations/_odata_operations.py | 2 + .../_skip_url_encoding_operations.py | 14 + ..._subscription_in_credentials_operations.py | 10 + .../_subscription_in_method_operations.py | 8 + .../_xms_client_request_id_operations.py | 4 + .../_api_version_default_operations.py | 8 + .../_api_version_local_operations.py | 8 + .../operations/_header_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_odata_operations.py | 2 + .../_skip_url_encoding_operations.py | 14 + ..._subscription_in_credentials_operations.py | 10 + .../_subscription_in_method_operations.py | 8 + .../_xms_client_request_id_operations.py | 4 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../aio/operations/_paging_operations.py | 49 +++- .../paging/operations/_paging_operations.py | 49 +++- .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../operations/_http_success_operations.py | 6 + .../aio/operations/_paging_operations.py | 49 +++- .../paging/operations/_paging_operations.py | 49 +++- .../_autorest_security_aad_operations.py | 2 + .../_autorest_security_aad_operations.py | 2 + .../_autorest_security_key_operations.py | 2 + .../_autorest_security_key_operations.py | 2 + .../_storage_accounts_operations.py | 19 +- .../aio/operations/_usage_operations.py | 2 + .../_storage_accounts_operations.py | 19 +- .../storage/operations/_usage_operations.py | 2 + .../aio/operations/_group_operations.py | 2 + .../operations/_group_operations.py | 2 + .../aio/operations/_operations.py | 8 + .../operations/_operations.py | 8 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../aio/operations/_operations.py | 60 +++++ .../operations/_operations.py | 60 +++++ .../aio/operations/_operations.py | 2 + .../operations/_operations.py | 2 + .../aio/operations/_operations.py | 49 +++- .../operations/_operations.py | 49 +++- .../aio/operations/_operations.py | 4 + .../operations/_operations.py | 4 + .../aio/operations/_operations.py | 6 + .../operations/_operations.py | 6 + .../aio/operations/_operations.py | 6 + .../operations/_operations.py | 6 + .../aio/operations/_operations.py | 7 +- .../operations/_operations.py | 7 +- .../aio/operations/_operations.py | 243 ++++++++++++------ .../operations/_operations.py | 243 ++++++++++++------ .../_operations/_operations.py | 6 +- .../aio/_operations/_operations.py | 6 +- .../aio/operations/_operations.py | 49 +++- .../operations/_operations.py | 49 +++- .../aio/operations/_operations.py | 21 +- .../operations/_operations.py | 21 +- .../aio/operations/_operations.py | 2 + .../operations/_operations.py | 2 + .../_operations/_operations.py | 9 +- .../aio/_operations/_operations.py | 9 +- .../_operations/_operations.py | 9 +- .../aio/_operations/_operations.py | 9 +- .../aio/operations/_operations.py | 10 + .../operations/_operations.py | 10 + .../aio/operations/_operations.py | 14 + .../operations/_operations.py | 14 + .../_operations/_operations.py | 9 +- .../aio/_operations/_operations.py | 9 +- .../_operation_group_one_operations.py | 2 + .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + ...stom_base_url_service_client_operations.py | 2 + ...stom_base_url_service_client_operations.py | 2 + ...stom_base_url_service_client_operations.py | 2 + ...stom_base_url_service_client_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_operation_group_one_operations.py | 2 + .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 12 +- .../_operation_group_one_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 2 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../_multiapi_service_client_operations.py | 4 + .../_operation_group_one_operations.py | 4 + .../_operation_group_two_operations.py | 4 + .../aio/operations/_operations.py | 24 +- .../operations/_operations.py | 24 +- .../v1/aio/operations/_operations.py | 14 +- .../v1/operations/_operations.py | 14 +- .../v2/aio/operations/_operations.py | 10 + .../v2/operations/_operations.py | 10 + .../v3/aio/operations/_operations.py | 12 + .../v3/operations/_operations.py | 12 + .../aio/operations/_pets_operations.py | 12 + .../operations/_pets_operations.py | 12 + .../operations/_anything_client_operations.py | 12 + .../operations/_anything_client_operations.py | 12 + .../aio/operations/_array_operations.py | 138 ++++++++++ .../bodyarray/operations/_array_operations.py | 138 ++++++++++ .../array/aio/operations/_array_operations.py | 138 ++++++++++ .../array/operations/_array_operations.py | 138 ++++++++++ .../aio/operations/_download_operations.py | 3 +- .../aio/operations/_upload_operations.py | 4 + .../operations/_download_operations.py | 3 +- .../operations/_upload_operations.py | 4 + .../aio/operations/_bool_operations.py | 12 + .../operations/_bool_operations.py | 12 + .../aio/operations/_byte_operations.py | 10 + .../bodybyte/operations/_byte_operations.py | 10 + .../aio/operations/_byte_operations.py | 10 + .../operations/_byte_operations.py | 10 + .../aio/operations/_array_operations.py | 10 + .../aio/operations/_basic_operations.py | 12 + .../aio/operations/_dictionary_operations.py | 12 + .../operations/_flattencomplex_operations.py | 2 + .../aio/operations/_inheritance_operations.py | 4 + .../_polymorphicrecursive_operations.py | 4 + .../operations/_polymorphism_operations.py | 18 ++ .../aio/operations/_primitive_operations.py | 44 ++++ .../_readonlyproperty_operations.py | 4 + .../operations/_array_operations.py | 10 + .../operations/_basic_operations.py | 12 + .../operations/_dictionary_operations.py | 12 + .../operations/_flattencomplex_operations.py | 2 + .../operations/_inheritance_operations.py | 4 + .../_polymorphicrecursive_operations.py | 4 + .../operations/_polymorphism_operations.py | 18 ++ .../operations/_primitive_operations.py | 44 ++++ .../_readonlyproperty_operations.py | 4 + .../aio/operations/_date_operations.py | 16 ++ .../bodydate/operations/_date_operations.py | 16 ++ .../aio/operations/_datetime_operations.py | 44 ++++ .../operations/_datetime_operations.py | 44 ++++ .../operations/_datetimerfc1123_operations.py | 18 ++ .../operations/_datetimerfc1123_operations.py | 18 ++ .../aio/operations/_dictionary_operations.py | 130 ++++++++++ .../operations/_dictionary_operations.py | 130 ++++++++++ .../aio/operations/_duration_operations.py | 8 + .../operations/_duration_operations.py | 8 + .../aio/operations/_files_operations.py | 9 +- .../bodyfile/operations/_files_operations.py | 9 +- .../aio/operations/_formdata_operations.py | 9 +- .../operations/_formdata_operations.py | 9 +- .../_formdataurlencoded_operations.py | 4 + .../_formdataurlencoded_operations.py | 4 + .../operations/_int_operations_operations.py | 28 ++ .../operations/_int_operations_operations.py | 28 ++ .../aio/operations/_number_operations.py | 48 ++++ .../operations/_number_operations.py | 48 ++++ .../aio/operations/_enum_operations.py | 12 + .../aio/operations/_string_operations.py | 26 ++ .../bodystring/operations/_enum_operations.py | 12 + .../operations/_string_operations.py | 26 ++ .../aio/operations/_time_operations.py | 4 + .../bodytime/operations/_time_operations.py | 4 + .../_client_with_enum_operations.py | 2 + .../_client_with_enum_operations.py | 2 + .../aio/operations/_contants_operations.py | 34 +++ .../operations/_contants_operations.py | 34 +++ .../aio/operations/_paths_operations.py | 2 + .../operations/_paths_operations.py | 2 + .../aio/operations/_paths_operations.py | 2 + .../operations/_paths_operations.py | 2 + .../_error_with_secrets_operations.py | 4 + .../_error_with_secrets_operations.py | 4 + .../aio/operations/_pet_operations.py | 4 + .../operations/_pet_operations.py | 4 + .../aio/operations/_header_operations.py | 58 +++++ .../header/operations/_header_operations.py | 58 +++++ .../_http_client_failure_operations.py | 52 ++++ .../operations/_http_failure_operations.py | 6 + .../operations/_http_redirects_operations.py | 32 +++ .../aio/operations/_http_retry_operations.py | 18 ++ .../_http_server_failure_operations.py | 8 + .../operations/_http_success_operations.py | 38 +++ .../_multiple_responses_operations.py | 68 +++++ .../_http_client_failure_operations.py | 52 ++++ .../operations/_http_failure_operations.py | 6 + .../operations/_http_redirects_operations.py | 32 +++ .../operations/_http_retry_operations.py | 18 ++ .../_http_server_failure_operations.py | 8 + .../operations/_http_success_operations.py | 38 +++ .../_multiple_responses_operations.py | 68 +++++ ...correct_returned_error_model_operations.py | 2 + ...correct_returned_error_model_operations.py | 2 + .../_media_types_client_operations.py | 14 + .../_media_types_client_operations.py | 14 + .../_media_types_client_operations.py | 14 + .../_media_types_client_operations.py | 14 + .../_merge_patch_json_client_operations.py | 2 + .../_merge_patch_json_client_operations.py | 2 + ...urce_flattening_test_service_operations.py | 22 ++ ...urce_flattening_test_service_operations.py | 22 ++ ...e_inheritance_service_client_operations.py | 20 ++ ...e_inheritance_service_client_operations.py | 20 ++ .../aio/operations/_float_operations.py | 4 + .../operations/_int_operations_operations.py | 4 + .../operations/_float_operations.py | 4 + .../operations/_int_operations_operations.py | 4 + .../_object_type_client_operations.py | 4 + .../_object_type_client_operations.py | 4 + .../operations/_anything_client_operations.py | 12 + .../operations/_anything_client_operations.py | 12 + .../_availability_sets_operations.py | 2 + .../_availability_sets_operations.py | 2 + ...parmaterized_endpoint_client_operations.py | 2 + ...parmaterized_endpoint_client_operations.py | 2 + .../_auto_rest_report_service_operations.py | 4 + .../_auto_rest_report_service_operations.py | 4 + .../aio/operations/_explicit_operations.py | 48 ++++ .../aio/operations/_implicit_operations.py | 16 ++ .../operations/_explicit_operations.py | 48 ++++ .../operations/_implicit_operations.py | 16 ++ .../_import_operations_operations.py | 2 + .../_reserved_words_client_operations.py | 12 + .../_import_operations_operations.py | 2 + .../_reserved_words_client_operations.py | 12 + .../_autorest_security_aad_operations.py | 2 + .../_autorest_security_aad_operations.py | 2 + ..._aad_swagger_credential_flag_operations.py | 2 + ..._aad_swagger_credential_flag_operations.py | 2 + .../_autorest_security_key_operations.py | 2 + .../_autorest_security_key_operations.py | 2 + ..._key_swagger_credential_flag_operations.py | 2 + ..._key_swagger_credential_flag_operations.py | 2 + .../aio/operations/_path_items_operations.py | 8 + .../url/aio/operations/_paths_operations.py | 54 ++++ .../url/aio/operations/_queries_operations.py | 70 +++++ .../url/operations/_path_items_operations.py | 8 + .../Url/url/operations/_paths_operations.py | 54 ++++ .../Url/url/operations/_queries_operations.py | 70 +++++ .../aio/operations/_queries_operations.py | 6 + .../operations/_queries_operations.py | 6 + .../_auto_rest_validation_test_operations.py | 8 + .../_auto_rest_validation_test_operations.py | 8 + .../aio/operations/_xml_operations.py | 68 +++++ .../xmlservice/operations/_xml_operations.py | 68 +++++ .../aio/operations/_pet_operations.py | 6 + .../operations/_pet_operations.py | 6 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../_operations/_operations.py | 12 + .../aio/_operations/_operations.py | 12 + .../aio/operations/_operations.py | 138 ++++++++++ .../operations/_operations.py | 138 ++++++++++ .../aio/operations/_operations.py | 7 +- .../operations/_operations.py | 7 +- .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../aio/operations/_operations.py | 10 + .../operations/_operations.py | 10 + .../aio/operations/_operations.py | 110 ++++++++ .../operations/_operations.py | 110 ++++++++ .../aio/operations/_operations.py | 18 ++ .../operations/_operations.py | 18 ++ .../aio/operations/_operations.py | 44 ++++ .../operations/_operations.py | 44 ++++ .../aio/operations/_operations.py | 16 ++ .../operations/_operations.py | 16 ++ .../aio/operations/_operations.py | 130 ++++++++++ .../operations/_operations.py | 130 ++++++++++ .../aio/operations/_operations.py | 8 + .../operations/_operations.py | 8 + .../aio/operations/_operations.py | 9 +- .../operations/_operations.py | 9 +- .../aio/operations/_operations.py | 3 +- .../operations/_operations.py | 3 +- .../aio/operations/_operations.py | 28 ++ .../operations/_operations.py | 28 ++ .../aio/operations/_operations.py | 48 ++++ .../operations/_operations.py | 48 ++++ .../aio/operations/_operations.py | 38 +++ .../operations/_operations.py | 38 +++ .../aio/operations/_operations.py | 4 + .../operations/_operations.py | 4 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../aio/operations/_operations.py | 34 +++ .../operations/_operations.py | 34 +++ .../aio/operations/_operations.py | 2 + .../operations/_operations.py | 2 + .../aio/operations/_operations.py | 2 + .../operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../aio/operations/_operations.py | 4 + .../operations/_operations.py | 4 + .../aio/operations/_operations.py | 58 +++++ .../operations/_operations.py | 58 +++++ .../aio/operations/_operations.py | 222 ++++++++++++++++ .../operations/_operations.py | 222 ++++++++++++++++ .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 12 + .../aio/_operations/_operations.py | 12 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 22 ++ .../aio/_operations/_operations.py | 22 ++ .../_operations/_operations.py | 20 ++ .../aio/_operations/_operations.py | 20 ++ .../_operations/_operations.py | 12 + .../aio/_operations/_operations.py | 12 + .../aio/operations/_operations.py | 8 + .../operations/_operations.py | 8 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../aio/operations/_operations.py | 2 + .../operations/_operations.py | 2 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../aio/operations/_operations.py | 64 +++++ .../operations/_operations.py | 64 +++++ .../aio/operations/_operations.py | 10 + .../operations/_operations.py | 10 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../aio/operations/_operations.py | 6 + .../operations/_operations.py | 6 + .../aio/operations/_operations.py | 132 ++++++++++ .../operations/_operations.py | 132 ++++++++++ .../_operations/_operations.py | 8 + .../aio/_operations/_operations.py | 8 + .../aio/operations/_operations.py | 68 +++++ .../operations/_operations.py | 68 +++++ .../aio/operations/_operations.py | 6 + .../operations/_operations.py | 6 + .../apikey/_operations/_operations.py | 4 + .../apikey/aio/_operations/_operations.py | 4 + .../http/custom/_operations/_operations.py | 4 + .../custom/aio/_operations/_operations.py | 4 + .../oauth2/_operations/_operations.py | 4 + .../oauth2/aio/_operations/_operations.py | 4 + .../union/_operations/_operations.py | 4 + .../union/aio/_operations/_operations.py | 4 + .../resources/aio/operations/_operations.py | 24 +- .../resources/operations/_operations.py | 24 +- .../core/usage/aio/operations/_operations.py | 2 + .../core/usage/operations/_operations.py | 2 + .../core/basic/aio/operations/_operations.py | 14 + .../core/basic/operations/_operations.py | 14 + .../lro/standard/_operations/_operations.py | 9 +- .../standard/aio/_operations/_operations.py | 9 +- .../core/scalar/aio/operations/_operations.py | 6 + .../core/scalar/operations/_operations.py | 6 + .../spheredpg/aio/operations/_operations.py | 79 ++++-- .../mgmt/spheredpg/operations/_operations.py | 79 ++++-- .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../lro/rpc/_operations/_operations.py | 3 +- .../lro/rpc/aio/_operations/_operations.py | 3 +- .../naming/aio/operations/_operations.py | 22 ++ .../client/naming/operations/_operations.py | 22 ++ .../service/aio/operations/_operations.py | 18 ++ .../service/operations/_operations.py | 18 ++ .../multiclient/_operations/_operations.py | 12 + .../aio/_operations/_operations.py | 12 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../bytes/aio/operations/_operations.py | 26 ++ .../encode/bytes/operations/_operations.py | 26 ++ .../datetime/aio/operations/_operations.py | 28 ++ .../encode/datetime/operations/_operations.py | 28 ++ .../duration/aio/operations/_operations.py | 24 ++ .../encode/duration/operations/_operations.py | 24 ++ .../_operations/_operations.py | 10 + .../aio/_operations/_operations.py | 10 + .../_operations/_operations.py | 10 + .../aio/_operations/_operations.py | 10 + .../basic/aio/operations/_operations.py | 4 + .../basic/operations/_operations.py | 4 + .../aio/operations/_operations.py | 8 + .../bodyoptionality/operations/_operations.py | 8 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../spread/aio/operations/_operations.py | 16 ++ .../spread/operations/_operations.py | 16 ++ .../mediatype/aio/operations/_operations.py | 4 + .../mediatype/operations/_operations.py | 4 + .../multipart/aio/operations/_operations.py | 16 ++ .../multipart/operations/_operations.py | 16 ++ .../pageable/_operations/_operations.py | 2 + .../pageable/aio/_operations/_operations.py | 2 + .../srv/driven1/_operations/_operations.py | 6 + .../driven1/aio/_operations/_operations.py | 6 + .../srv/driven2/_operations/_operations.py | 8 + .../driven2/aio/_operations/_operations.py | 8 + .../json/aio/operations/_operations.py | 2 + .../json/operations/_operations.py | 2 + .../notdefined/_operations/_operations.py | 2 + .../notdefined/aio/_operations/_operations.py | 2 + .../path/multiple/_operations/_operations.py | 4 + .../multiple/aio/_operations/_operations.py | 4 + .../path/single/_operations/_operations.py | 2 + .../single/aio/_operations/_operations.py | 2 + .../notversioned/_operations/_operations.py | 6 + .../aio/_operations/_operations.py | 6 + .../versioned/_operations/_operations.py | 8 + .../versioned/aio/_operations/_operations.py | 8 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../repeatability/_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../aio/operations/_operations.py | 202 +++++++++++++++ .../specialwords/operations/_operations.py | 202 +++++++++++++++ .../array/aio/operations/_operations.py | 28 ++ .../typetest/array/operations/_operations.py | 28 ++ .../dictionary/aio/operations/_operations.py | 22 ++ .../dictionary/operations/_operations.py | 22 ++ .../extensible/aio/operations/_operations.py | 4 + .../enum/extensible/operations/_operations.py | 4 + .../enum/fixed/aio/operations/_operations.py | 4 + .../enum/fixed/operations/_operations.py | 4 + .../model/empty/_operations/_operations.py | 2 + .../empty/aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../recursive/_operations/_operations.py | 2 + .../recursive/aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../model/usage/_operations/_operations.py | 2 + .../usage/aio/_operations/_operations.py | 2 + .../visibility/_operations/_operations.py | 10 + .../visibility/aio/_operations/_operations.py | 10 + .../aio/operations/_operations.py | 64 +++++ .../operations/_operations.py | 64 +++++ .../nullable/aio/operations/_operations.py | 28 ++ .../nullable/operations/_operations.py | 28 ++ .../optional/aio/operations/_operations.py | 56 ++++ .../optional/operations/_operations.py | 56 ++++ .../valuetypes/aio/operations/_operations.py | 58 +++++ .../valuetypes/operations/_operations.py | 58 +++++ .../scalar/aio/operations/_operations.py | 18 ++ .../typetest/scalar/operations/_operations.py | 18 ++ .../union/aio/operations/_operations.py | 20 ++ .../typetest/union/operations/_operations.py | 20 ++ .../specification/mgmt/sphere/catalog.tsp | 24 +- .../specification/mgmt/sphere/certificate.tsp | 10 +- .../specification/mgmt/sphere/device.tsp | 20 +- .../specification/mgmt/sphere/deviceGroup.tsp | 25 +- .../specification/mgmt/sphere/product.tsp | 6 +- .../apikey/_operations/_operations.py | 4 + .../apikey/aio/_operations/_operations.py | 4 + .../http/custom/_operations/_operations.py | 4 + .../custom/aio/_operations/_operations.py | 4 + .../oauth2/_operations/_operations.py | 4 + .../oauth2/aio/_operations/_operations.py | 4 + .../union/_operations/_operations.py | 4 + .../union/aio/_operations/_operations.py | 4 + .../naming/aio/operations/_operations.py | 22 ++ .../client/naming/operations/_operations.py | 22 ++ .../service/aio/operations/_operations.py | 18 ++ .../service/operations/_operations.py | 18 ++ .../multiclient/_operations/_operations.py | 12 + .../aio/_operations/_operations.py | 12 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../bytes/aio/operations/_operations.py | 26 ++ .../encode/bytes/operations/_operations.py | 26 ++ .../datetime/aio/operations/_operations.py | 28 ++ .../encode/datetime/operations/_operations.py | 28 ++ .../duration/aio/operations/_operations.py | 24 ++ .../encode/duration/operations/_operations.py | 24 ++ .../_operations/_operations.py | 10 + .../aio/_operations/_operations.py | 10 + .../_operations/_operations.py | 10 + .../aio/_operations/_operations.py | 10 + .../basic/aio/operations/_operations.py | 4 + .../basic/operations/_operations.py | 4 + .../aio/operations/_operations.py | 8 + .../bodyoptionality/operations/_operations.py | 8 + .../aio/operations/_operations.py | 12 + .../operations/_operations.py | 12 + .../spread/aio/operations/_operations.py | 16 ++ .../spread/operations/_operations.py | 16 ++ .../mediatype/aio/operations/_operations.py | 4 + .../mediatype/operations/_operations.py | 4 + .../multipart/aio/operations/_operations.py | 16 ++ .../multipart/operations/_operations.py | 16 ++ .../pageable/_operations/_operations.py | 2 + .../pageable/aio/_operations/_operations.py | 2 + .../srv/driven1/_operations/_operations.py | 6 + .../driven1/aio/_operations/_operations.py | 6 + .../srv/driven2/_operations/_operations.py | 8 + .../driven2/aio/_operations/_operations.py | 8 + .../json/aio/operations/_operations.py | 2 + .../json/operations/_operations.py | 2 + .../notdefined/_operations/_operations.py | 2 + .../notdefined/aio/_operations/_operations.py | 2 + .../path/multiple/_operations/_operations.py | 4 + .../multiple/aio/_operations/_operations.py | 4 + .../path/single/_operations/_operations.py | 2 + .../single/aio/_operations/_operations.py | 2 + .../notversioned/_operations/_operations.py | 6 + .../aio/_operations/_operations.py | 6 + .../versioned/_operations/_operations.py | 8 + .../versioned/aio/_operations/_operations.py | 8 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../repeatability/_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../aio/operations/_operations.py | 202 +++++++++++++++ .../specialwords/operations/_operations.py | 202 +++++++++++++++ .../array/aio/operations/_operations.py | 28 ++ .../typetest/array/operations/_operations.py | 28 ++ .../dictionary/aio/operations/_operations.py | 22 ++ .../dictionary/operations/_operations.py | 22 ++ .../extensible/aio/operations/_operations.py | 4 + .../enum/extensible/operations/_operations.py | 4 + .../enum/fixed/aio/operations/_operations.py | 4 + .../enum/fixed/operations/_operations.py | 4 + .../model/empty/_operations/_operations.py | 2 + .../empty/aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../_operations/_operations.py | 2 + .../aio/_operations/_operations.py | 2 + .../recursive/_operations/_operations.py | 2 + .../recursive/aio/_operations/_operations.py | 2 + .../_operations/_operations.py | 4 + .../aio/_operations/_operations.py | 4 + .../model/usage/_operations/_operations.py | 2 + .../usage/aio/_operations/_operations.py | 2 + .../visibility/_operations/_operations.py | 10 + .../visibility/aio/_operations/_operations.py | 10 + .../aio/operations/_operations.py | 64 +++++ .../operations/_operations.py | 64 +++++ .../nullable/aio/operations/_operations.py | 28 ++ .../nullable/operations/_operations.py | 28 ++ .../optional/aio/operations/_operations.py | 56 ++++ .../optional/operations/_operations.py | 56 ++++ .../valuetypes/aio/operations/_operations.py | 58 +++++ .../valuetypes/operations/_operations.py | 58 +++++ .../scalar/aio/operations/_operations.py | 18 ++ .../typetest/scalar/operations/_operations.py | 18 ++ .../union/aio/operations/_operations.py | 20 ++ .../typetest/union/operations/_operations.py | 20 ++ 717 files changed, 11945 insertions(+), 545 deletions(-) create mode 100644 .chronus/changes/stream_reading-2024-5-25-18-18-57.md diff --git a/.chronus/changes/stream_reading-2024-5-25-18-18-57.md b/.chronus/changes/stream_reading-2024-5-25-18-18-57.md new file mode 100644 index 00000000000..c5dadf229ac --- /dev/null +++ b/.chronus/changes/stream_reading-2024-5-25-18-18-57.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +ensure all streamed responses are read before throwing an error \ No newline at end of file diff --git a/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py b/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py index 3d1196354fb..4f7e0438a46 100644 --- a/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py +++ b/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py @@ -961,11 +961,12 @@ def response_headers_and_deserialization( def handle_error_response(self, builder: OperationType) -> List[str]: async_await = "await " if self.async_mode else "" retval = [f"if response.status_code not in {str(builder.success_status_codes)}:"] - response_read = f" {async_await}response.read() # Load the body in memory and close the socket" - if builder.stream_value is True: # _stream is True so no need to judge it - retval.append(response_read) - elif isinstance(builder.stream_value, str): # _stream is not sure, so we need to judge it - retval.extend([" if _stream:", f" {response_read}"]) + retval.extend( + [ + " if _stream:", + f" {async_await} response.read() # Load the body in memory and close the socket", + ] + ) type_ignore = " # type: ignore" if _need_type_ignore(builder) else "" retval.append( f" map_error(status_code=response.status_code, response=response, error_map=error_map){type_ignore}" diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py index 245c0dca360..95dea1fd1f8 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py @@ -87,6 +87,8 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -128,6 +130,8 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -169,6 +173,8 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py index 06a1c5a507c..15b8dd6ceb8 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py @@ -107,6 +107,8 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -148,6 +150,8 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -189,6 +193,8 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py index 5538e175fa1..dfc2e217633 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py @@ -87,6 +87,8 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -128,6 +130,8 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -169,6 +173,8 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py index ef681bdb009..4438956a3f3 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py @@ -107,6 +107,8 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -148,6 +150,8 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -189,6 +193,8 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 2531629a4db..441a6ed17cd 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 @@ -119,7 +119,8 @@ def _basic_polling_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -337,6 +338,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 0cae8dea7e9..2fb8f10495f 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 @@ -90,7 +90,8 @@ async def _basic_polling_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +313,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py index bb59d85b1e3..1ee6aaec91d 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py index 56dc9ccada8..2649d7f9ba4 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 a7c82b6194b..cc124dd131c 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 @@ -100,6 +100,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -152,7 +154,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -301,7 +304,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -396,6 +400,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -485,6 +491,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py index 58851cbf52f..18e160f50f7 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py @@ -92,6 +92,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 02c24a003cb..1a557523176 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 @@ -178,6 +178,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -230,7 +232,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -471,6 +475,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -560,6 +566,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py index 561943a960c..e27867bf6fd 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py @@ -114,6 +114,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py index 47ddab4fe92..d64b8faa5f8 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py @@ -87,6 +87,8 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,6 +147,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 1de1738cb95..cee9850f79b 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 @@ -145,6 +145,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -193,6 +195,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py index f7c47ddb9ba..2dca79cc775 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py @@ -97,6 +97,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py index 72d72fbc1bf..05e2cc1af61 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py @@ -136,6 +136,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -194,6 +196,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 c5092565656..03c862e297d 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 @@ -189,6 +189,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -237,6 +239,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py index 3c03b70fd3f..62dcf13cde0 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py @@ -118,6 +118,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py index 98d4d40cbd8..1864cba2ae2 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py @@ -112,6 +112,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -173,6 +175,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 42477c6b994..ad648d617d5 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 @@ -126,6 +126,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -226,6 +228,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 ff44faae8ed..c6a8b9c2a2c 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 @@ -146,6 +146,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -190,6 +192,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py index e811c27d290..0e78b6b6062 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py @@ -155,6 +155,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 bfd44f9ad86..9ee78a84c95 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 @@ -161,6 +161,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -261,6 +263,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 f46fffbb03d..4752c605c6b 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 @@ -190,6 +190,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -234,6 +236,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py index d40897cf72d..37d3ab276d3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -93,6 +93,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -148,6 +150,8 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -190,6 +194,8 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +242,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py index 9c1338c4946..41f519a32c1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py @@ -150,6 +150,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,6 +207,8 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -247,6 +251,8 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -293,6 +299,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py index 7c37246f0a1..e450414482d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py @@ -118,6 +118,8 @@ async def post_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -175,6 +177,8 @@ async def post_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -235,6 +239,8 @@ async def post_reserved_words( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -305,6 +311,8 @@ async def post_multi_param_groups( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -359,6 +367,8 @@ async def post_shared_parameter_group_object( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -414,6 +424,8 @@ async def group_with_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py index df87133b186..d1d5dd07afa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py @@ -264,6 +264,8 @@ def post_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -321,6 +323,8 @@ def post_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -381,6 +385,8 @@ def post_reserved_words( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -451,6 +457,8 @@ def post_multi_param_groups( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -505,6 +513,8 @@ def post_shared_parameter_group_object( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -560,6 +570,8 @@ def group_with_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py index 4e3e122da68..4ba1a3fb20d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py @@ -77,6 +77,8 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py index fb241567648..ba1a18a0035 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py @@ -100,6 +100,8 @@ def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py index 02f544ff814..518a503d154 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py @@ -95,6 +95,8 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -141,6 +143,8 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -185,6 +189,8 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -229,6 +235,8 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py index 38970a14786..868d2bf5115 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py @@ -95,6 +95,8 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -143,6 +145,8 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -187,6 +191,8 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -231,6 +237,8 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py index 75a258b673a..90984ec1f6b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py @@ -96,6 +96,8 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -154,6 +156,8 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -202,6 +206,8 @@ async def custom_named_request_id_head(self, foo_client_request_id: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py index d5c0644739e..711a6161e54 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py @@ -99,6 +99,8 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py index f0925860564..583b0c8509a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py @@ -101,6 +101,8 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -148,6 +150,8 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -239,6 +245,8 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -286,6 +294,8 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -333,6 +343,8 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -377,6 +389,8 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py index a1de01bdf6f..387548354b0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py @@ -96,6 +96,8 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -140,6 +142,8 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -188,6 +192,8 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -232,6 +238,8 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -276,6 +284,8 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py index 748990f30b4..f43a5388797 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py @@ -99,6 +99,8 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -148,6 +150,8 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -197,6 +201,8 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -246,6 +252,8 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py index e0fe210d664..a1004ee5e0e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py @@ -88,6 +88,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -136,6 +138,8 @@ async def param_get( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py index 08a341e565e..aa332059637 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py @@ -171,6 +171,8 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -217,6 +219,8 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -261,6 +265,8 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -305,6 +311,8 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py index 7932e99da0b..7071d39b939 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py @@ -169,6 +169,8 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -217,6 +219,8 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -261,6 +265,8 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -305,6 +311,8 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py index 7d34b5f7f6e..dbf97c2a8cc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py @@ -145,6 +145,8 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -203,6 +205,8 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -251,6 +255,8 @@ def custom_named_request_id_head(self, foo_client_request_id: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py index 383d8c79789..40b1f802528 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py @@ -128,6 +128,8 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py index 5c517f3890e..6faf7a7a4eb 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py @@ -228,6 +228,8 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -275,6 +277,8 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -319,6 +323,8 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -364,6 +370,8 @@ def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -411,6 +419,8 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -456,6 +466,8 @@ def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -500,6 +512,8 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py index 5884c1fb0fb..33740ae67f3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py @@ -209,6 +209,8 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -253,6 +255,8 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -301,6 +305,8 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -345,6 +351,8 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -389,6 +397,8 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py index 6f177d565ec..1f10df01c54 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py @@ -184,6 +184,8 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -233,6 +235,8 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -282,6 +286,8 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -331,6 +337,8 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py index 718434cb471..4c16deef6c2 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py @@ -114,6 +114,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -162,6 +164,8 @@ def param_get( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index e3a716bc790..7fed59ce996 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -94,6 +94,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 59776137c70..28f8d219ce4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -110,6 +110,8 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py index 60b16fc9924..889a7c84efd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py @@ -151,6 +151,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -222,6 +224,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -293,6 +297,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -364,6 +370,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -444,6 +452,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -516,6 +526,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -605,6 +617,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -677,6 +691,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -753,6 +769,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -830,6 +848,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -919,6 +939,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1011,6 +1033,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1083,6 +1107,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1155,6 +1181,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1226,6 +1254,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1297,6 +1327,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1368,6 +1400,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1443,6 +1477,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1526,6 +1562,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1575,7 +1613,8 @@ async def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1671,6 +1710,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1783,6 +1824,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1857,6 +1900,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1931,6 +1976,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py index f12a11c9520..0da46d31751 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py @@ -612,6 +612,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -683,6 +685,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -754,6 +758,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -825,6 +831,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -905,6 +913,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -977,6 +987,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1066,6 +1078,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1138,6 +1152,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1214,6 +1230,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1289,6 +1307,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1378,6 +1398,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1470,6 +1492,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1542,6 +1566,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1614,6 +1640,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1685,6 +1713,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1756,6 +1786,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1827,6 +1859,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1902,6 +1936,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1985,6 +2021,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2034,7 +2072,8 @@ def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2130,6 +2169,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2242,6 +2283,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2316,6 +2359,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2390,6 +2435,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py index 687b3728e8a..78c396239bc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py @@ -120,6 +120,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -195,6 +197,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py index 231d2fd782e..89798aa5d59 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py @@ -169,6 +169,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +246,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py index 33863e97cb7..cdc4be25b64 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py index 770f45c3326..7cb5cd048e4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py index 3a592056181..87892a4f668 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py index b655fa4c85b..16cd2e0d9f3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py index ac8f1ee4916..e1a6a5014b7 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py index 5aeda471691..512f3a613ed 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 c0238978cd6..9fdc0f5a7f7 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 @@ -106,7 +106,8 @@ async def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -277,7 +278,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -437,7 +439,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -587,7 +590,8 @@ async def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 ede2954b4ef..f6ed22c9571 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 @@ -109,7 +109,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -266,7 +267,8 @@ async def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -419,7 +421,8 @@ async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -516,7 +519,8 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> AsyncIterator[byte response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -603,7 +607,8 @@ async def _delete_async_relative_retry_succeeded_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -710,7 +715,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -857,7 +863,8 @@ async def _post_async_relative_retry_succeeded_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 5eb29620b53..2e6c529cd5d 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 @@ -146,7 +146,8 @@ async def _put200_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -300,7 +301,8 @@ async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -461,7 +463,8 @@ async def _patch201_retry_with_async_header_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -620,7 +623,8 @@ async def _patch202_retry_with_async_and_location_header_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -780,7 +784,8 @@ async def _put201_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -913,7 +918,8 @@ async def _post202_list_initial(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1026,7 +1032,8 @@ async def _put200_succeeded_no_state_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1176,7 +1183,8 @@ async def _put202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1329,7 +1337,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1486,7 +1495,8 @@ async def _put200_updating_succeeded204_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1639,7 +1649,8 @@ async def _put201_creating_failed200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1796,7 +1807,8 @@ async def _put200_acceptedcanceled200_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1949,7 +1961,8 @@ async def _put_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2106,7 +2119,8 @@ async def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2274,7 +2288,8 @@ async def _put_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2440,7 +2455,8 @@ async def _put_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2608,7 +2624,8 @@ async def _put_async_no_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2774,7 +2791,8 @@ async def _put_async_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2938,7 +2956,8 @@ async def _put_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3076,7 +3095,8 @@ async def _put_async_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3208,7 +3228,8 @@ async def _put_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3314,7 +3335,8 @@ async def _put_async_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3411,7 +3433,8 @@ async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3510,7 +3533,8 @@ async def _delete_provisioning202_deleting_failed200_initial( # pylint: disable response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3609,7 +3633,8 @@ async def _delete_provisioning202_deletingcanceled200_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3706,7 +3731,8 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3786,7 +3812,8 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> AsyncIterator[byte response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3880,7 +3907,8 @@ async def _delete202_no_retry204_initial(self, **kwargs: Any) -> AsyncIterator[b response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3974,7 +4002,8 @@ async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> AsyncIterat response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4062,7 +4091,8 @@ async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> Async response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4150,7 +4180,8 @@ async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> AsyncIte response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4238,7 +4269,8 @@ async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> Async response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4326,7 +4358,8 @@ async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> AsyncIterat response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4414,7 +4447,8 @@ async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> AsyncItera response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4502,7 +4536,8 @@ async def _post200_with_payload_initial(self, **kwargs: Any) -> AsyncIterator[by response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4608,7 +4643,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4755,7 +4791,8 @@ async def _post202_no_retry204_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4899,7 +4936,8 @@ async def _post_double_headers_final_location_get_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4992,7 +5030,8 @@ async def _post_double_headers_final_azure_header_get_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5086,7 +5125,8 @@ async def _post_double_headers_final_azure_header_get_default_initial( # pylint response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5192,7 +5232,8 @@ async def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5356,7 +5397,8 @@ async def _post_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5520,7 +5562,8 @@ async def _post_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5673,7 +5716,8 @@ async def _post_async_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 c0cb93b02ae..b10dc80c338 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 @@ -128,7 +128,8 @@ async def _put_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -279,7 +280,8 @@ async def _put_non_retry201_creating400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -433,7 +435,8 @@ async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -587,7 +590,8 @@ async def _put_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -735,7 +739,8 @@ async def _delete_non_retry400_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -819,7 +824,8 @@ async def _delete202_non_retry400_initial(self, **kwargs: Any) -> AsyncIterator[ response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -903,7 +909,8 @@ async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> AsyncI response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1008,7 +1015,8 @@ async def _post_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1152,7 +1160,8 @@ async def _post202_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1296,7 +1305,8 @@ async def _post_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1446,7 +1456,8 @@ async def _put_error201_no_provisioning_state_payload_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1597,7 +1608,8 @@ async def _put_async_relative_retry_no_status_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1765,7 +1777,8 @@ async def _put_async_relative_retry_no_status_payload_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1916,7 +1929,8 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1998,7 +2012,8 @@ async def _delete_async_relative_retry_no_status_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2105,7 +2120,8 @@ async def _post202_no_location_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2252,7 +2268,8 @@ async def _post_async_relative_retry_no_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2405,7 +2422,8 @@ async def _put200_invalid_json_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2559,7 +2577,8 @@ async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2727,7 +2746,8 @@ async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2878,7 +2898,8 @@ async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> AsyncI response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2965,7 +2986,8 @@ async def _delete_async_relative_retry_invalid_header_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3057,7 +3079,8 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3164,7 +3187,8 @@ async def _post202_retry_invalid_header_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3311,7 +3335,8 @@ async def _post_async_relative_retry_invalid_header_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3464,7 +3489,8 @@ async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 ca16b89a2ad..49faf59ead3 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 @@ -172,7 +172,8 @@ def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -340,7 +341,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -497,7 +499,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -647,7 +650,8 @@ def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 fa4d2dc898d..65fa4a2b1e6 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 @@ -216,7 +216,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -370,7 +371,8 @@ def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -520,7 +522,8 @@ def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -616,7 +619,8 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -703,7 +707,8 @@ def _delete_async_relative_retry_succeeded_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -810,7 +815,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -957,7 +963,8 @@ def _post_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 af97bcee23d..a10f0251559 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 @@ -813,7 +813,8 @@ def _put200_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -964,7 +965,8 @@ def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1122,7 +1124,8 @@ def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1277,7 +1280,8 @@ def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1434,7 +1438,8 @@ def _put201_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1564,7 +1569,8 @@ def _post202_list_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1675,7 +1681,8 @@ def _put200_succeeded_no_state_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1822,7 +1829,8 @@ def _put202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1972,7 +1980,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2126,7 +2135,8 @@ def _put200_updating_succeeded204_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2276,7 +2286,8 @@ def _put201_creating_failed200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2430,7 +2441,8 @@ def _put200_acceptedcanceled200_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2580,7 +2592,8 @@ def _put_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2734,7 +2747,8 @@ def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2899,7 +2913,8 @@ def _put_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3062,7 +3077,8 @@ def _put_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3227,7 +3243,8 @@ def _put_async_no_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3390,7 +3407,8 @@ def _put_async_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3551,7 +3569,8 @@ def _put_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3687,7 +3706,8 @@ def _put_async_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3815,7 +3835,8 @@ def _put_sub_resource_initial(self, provisioning_state: Optional[str] = None, ** response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3920,7 +3941,8 @@ def _put_async_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4016,7 +4038,8 @@ def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4114,7 +4137,8 @@ def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4212,7 +4236,8 @@ def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4308,7 +4333,8 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4388,7 +4414,8 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4481,7 +4508,8 @@ def _delete202_no_retry204_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4574,7 +4602,8 @@ def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4662,7 +4691,8 @@ def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> Iterator[by response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4750,7 +4780,8 @@ def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4838,7 +4869,8 @@ def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> Iterator[by response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4926,7 +4958,8 @@ def _delete_async_retry_failed_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5014,7 +5047,8 @@ def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5102,7 +5136,8 @@ def _post200_with_payload_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5206,7 +5241,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5353,7 +5389,8 @@ def _post202_no_retry204_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5494,7 +5531,8 @@ def _post_double_headers_final_location_get_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5586,7 +5624,8 @@ def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5678,7 +5717,8 @@ def _post_double_headers_final_azure_header_get_default_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5783,7 +5823,8 @@ def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5944,7 +5985,8 @@ def _post_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6105,7 +6147,8 @@ def _post_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6258,7 +6301,8 @@ def _post_async_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 1bc96f96b01..2fde1e1c9a7 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 @@ -540,7 +540,8 @@ def _put_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -688,7 +689,8 @@ def _put_non_retry201_creating400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -839,7 +841,8 @@ def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -990,7 +993,8 @@ def _put_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1135,7 +1139,8 @@ def _delete_non_retry400_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1219,7 +1224,8 @@ def _delete202_non_retry400_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1303,7 +1309,8 @@ def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> Iterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1408,7 +1415,8 @@ def _post_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1552,7 +1560,8 @@ def _post202_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1696,7 +1705,8 @@ def _post_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1846,7 +1856,8 @@ def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1994,7 +2005,8 @@ def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2159,7 +2171,8 @@ def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2307,7 +2320,8 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2389,7 +2403,8 @@ def _delete_async_relative_retry_no_status_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2496,7 +2511,8 @@ def _post202_no_location_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2643,7 +2659,8 @@ def _post_async_relative_retry_no_payload_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2796,7 +2813,8 @@ def _put200_invalid_json_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2947,7 +2965,8 @@ def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3112,7 +3131,8 @@ def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3260,7 +3280,8 @@ def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> Iterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3347,7 +3368,8 @@ def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3439,7 +3461,8 @@ def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3546,7 +3569,8 @@ def _post202_retry_invalid_header_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3693,7 +3717,8 @@ def _post_async_relative_retry_invalid_header_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3846,7 +3871,8 @@ def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py index c272d9f361e..45dfd95547b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py @@ -76,7 +76,8 @@ async def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,7 +190,8 @@ async def _poll_with_constant_parameterized_endpoints_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py index 4f8dcc3e2c4..bda89e27617 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py @@ -113,7 +113,8 @@ def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -226,7 +227,8 @@ def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py index d80c9b2b066..650cb019dfe 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py @@ -94,6 +94,8 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -140,6 +142,8 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -184,6 +188,8 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -228,6 +234,8 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py index 5bada23444c..cfcd7858823 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py @@ -94,6 +94,8 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -142,6 +144,8 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -186,6 +190,8 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -230,6 +236,8 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py index 4c3e51ad37b..52f5b9ea966 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py @@ -95,6 +95,8 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -153,6 +155,8 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -203,6 +207,8 @@ async def custom_named_request_id_head( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py index d891f6dda51..b5724e8c210 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py @@ -86,6 +86,8 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -127,6 +129,8 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py index c1bdcf2e2c8..7ddda776302 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py @@ -98,6 +98,8 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py index 33b9c1cafa5..26e11483186 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py @@ -100,6 +100,8 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -147,6 +149,8 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -191,6 +195,8 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -238,6 +244,8 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -285,6 +293,8 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -332,6 +342,8 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -376,6 +388,8 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py index 3ad0306cae7..dfdba2c35ba 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py @@ -95,6 +95,8 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -139,6 +141,8 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -187,6 +191,8 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -231,6 +237,8 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -275,6 +283,8 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py index adb3ad5ff2b..6aab470b98b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py @@ -98,6 +98,8 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -147,6 +149,8 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -196,6 +200,8 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -245,6 +251,8 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py index 9aa87cdb51e..e7922dc9f88 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py @@ -87,6 +87,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -135,6 +137,8 @@ async def param_get( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py index 75876c6739c..3e331368aa8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py @@ -170,6 +170,8 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -216,6 +218,8 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -260,6 +264,8 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -304,6 +310,8 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py index a6ed57fa602..17ef2ee09f9 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py @@ -168,6 +168,8 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -216,6 +218,8 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -260,6 +264,8 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -304,6 +310,8 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py index 9c0d9900530..c7b384341d5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py @@ -144,6 +144,8 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -202,6 +204,8 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -252,6 +256,8 @@ def custom_named_request_id_head( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py index 99264f5ec0d..d287b448689 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py @@ -110,6 +110,8 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -151,6 +153,8 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py index 8c3ea330dd3..afba7548ed0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py @@ -127,6 +127,8 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py index 550645f911b..388079ab7ab 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py @@ -227,6 +227,8 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -274,6 +276,8 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -318,6 +322,8 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -363,6 +369,8 @@ def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -410,6 +418,8 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -455,6 +465,8 @@ def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -499,6 +511,8 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py index 3091199b058..940ce5daf74 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py @@ -208,6 +208,8 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -252,6 +254,8 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -300,6 +304,8 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -344,6 +350,8 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -388,6 +396,8 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py index 9efaa477f62..225d4c4196d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py @@ -183,6 +183,8 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -232,6 +234,8 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -281,6 +285,8 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -330,6 +336,8 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py index 3f7e2a413eb..069f4f906e3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py @@ -113,6 +113,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -161,6 +163,8 @@ def param_get( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py index b9becc20c3e..858feb968fc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py index 2fe1fcc9132..1efa73c0ab5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py index 9cd929088ba..37612799613 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py @@ -149,6 +149,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -220,6 +222,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -291,6 +295,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -362,6 +368,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -442,6 +450,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -514,6 +524,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -603,6 +615,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -675,6 +689,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -751,6 +767,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -828,6 +846,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -917,6 +937,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1009,6 +1031,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1081,6 +1105,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1153,6 +1179,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1224,6 +1252,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1295,6 +1325,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1366,6 +1398,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1441,6 +1475,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1524,6 +1560,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1573,7 +1611,8 @@ async def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1669,6 +1708,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1781,6 +1822,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1855,6 +1898,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1929,6 +1974,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py index 61a8addd452..dc22d6e439a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py @@ -610,6 +610,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -681,6 +683,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -752,6 +756,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -823,6 +829,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -903,6 +911,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -975,6 +985,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1064,6 +1076,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1136,6 +1150,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1212,6 +1228,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1287,6 +1305,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1376,6 +1396,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1468,6 +1490,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1540,6 +1564,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1612,6 +1638,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1683,6 +1711,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1754,6 +1784,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1825,6 +1857,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1900,6 +1934,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1983,6 +2019,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2032,7 +2070,8 @@ def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2128,6 +2167,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2240,6 +2281,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2314,6 +2357,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2388,6 +2433,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py index 110bfd14ef7..e319d944cd6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py index 886e35b6db6..8a83d55bb32 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py index 03e51fedea6..72528972de3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py index 16410985553..430bfc761dd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py index 2c7b8875a54..7d44cd4b3d7 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py @@ -84,6 +84,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -126,6 +128,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -168,6 +172,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py index 3557d960bec..ce58cbbcd02 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py index 6976711ed27..c7c1f6f2ee8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py @@ -148,6 +148,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -219,6 +221,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -290,6 +294,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -361,6 +367,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -441,6 +449,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -513,6 +523,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -601,6 +613,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -673,6 +687,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -749,6 +765,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -826,6 +844,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -915,6 +935,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1007,6 +1029,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1079,6 +1103,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1151,6 +1177,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1222,6 +1250,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1293,6 +1323,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1364,6 +1396,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1439,6 +1473,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1522,6 +1558,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1571,7 +1609,8 @@ async def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1666,6 +1705,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1778,6 +1819,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1852,6 +1895,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1926,6 +1971,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index abee3fdd960..62f83e00e17 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -609,6 +609,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -680,6 +682,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -751,6 +755,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -822,6 +828,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -902,6 +910,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -974,6 +984,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1062,6 +1074,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1134,6 +1148,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1210,6 +1226,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1285,6 +1303,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1374,6 +1394,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1466,6 +1488,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1538,6 +1562,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1610,6 +1636,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1681,6 +1709,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1752,6 +1782,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1823,6 +1855,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1898,6 +1932,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1981,6 +2017,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2030,7 +2068,8 @@ def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2124,6 +2163,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2236,6 +2277,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2310,6 +2353,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2384,6 +2429,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py index 7e285984f70..16f438cd590 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py @@ -70,6 +70,8 @@ async def head(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py index def1e8d9882..00b66763231 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py @@ -80,6 +80,8 @@ def head(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py index c59aef52307..d8052e1d1d1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py @@ -70,6 +70,8 @@ async def head(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py index f47b7635ed0..e6b6851da3a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py @@ -80,6 +80,8 @@ def head(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py index 67d4e154694..dc347b578fa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py @@ -166,6 +166,8 @@ async def check_name_availability( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -227,7 +229,8 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -432,6 +435,8 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -489,6 +494,8 @@ async def get_properties( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -646,6 +653,8 @@ async def update( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -701,6 +710,8 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -779,6 +790,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -860,6 +873,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -928,6 +943,8 @@ async def regenerate_key( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py index 4a2ba29a7ca..22f6a689105 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py @@ -91,6 +91,8 @@ async def list(self, **kwargs: Any) -> _models.UsageListResult: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index 56ca8d84035..a5572274c14 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -428,6 +428,8 @@ def check_name_availability( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -489,7 +491,8 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -694,6 +697,8 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -749,6 +754,8 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -906,6 +913,8 @@ def update( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -961,6 +970,8 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1039,6 +1050,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1118,6 +1131,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1186,6 +1201,8 @@ def regenerate_key( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py index b3fe3824730..abd98b97f01 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py @@ -118,6 +118,8 @@ def list(self, **kwargs: Any) -> _models.UsageListResult: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py index 44342138de4..0bf1becd310 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py @@ -94,6 +94,8 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py index eec9a10b9a8..5e1206a5017 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py @@ -124,6 +124,8 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index ad1d6ad9b1d..d83541e2e02 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -90,6 +90,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -147,6 +149,8 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -188,6 +192,8 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -236,6 +242,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index e3acfd5eb88..50e1d1adc5d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -149,6 +149,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -206,6 +208,8 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -247,6 +251,8 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -295,6 +301,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py index b6be82eda4f..eb1b86f8e63 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py @@ -109,6 +109,8 @@ async def post_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -158,6 +160,8 @@ async def post_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -209,6 +213,8 @@ async def post_reserved_words( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -270,6 +276,8 @@ async def post_multi_param_groups( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -319,6 +327,8 @@ async def post_shared_parameter_group_object( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -375,6 +385,8 @@ async def group_with_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py index 3c0d70637a6..55bc152f6f4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py @@ -251,6 +251,8 @@ def post_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -300,6 +302,8 @@ def post_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -351,6 +355,8 @@ def post_reserved_words( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -412,6 +418,8 @@ def post_multi_param_groups( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -461,6 +469,8 @@ def post_shared_parameter_group_object( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -517,6 +527,8 @@ def group_with_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py index be46ac8c282..a89eab1f3f1 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py @@ -109,6 +109,8 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py index 7a4c55b2f27..f6f5e750548 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py @@ -84,6 +84,8 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py index 8f60c11b862..a098ecfa90c 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py @@ -117,6 +117,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -159,6 +161,8 @@ async def param_get(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -220,6 +224,8 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -263,6 +269,8 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -309,6 +317,8 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -352,6 +362,8 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -395,6 +407,8 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -461,6 +475,8 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -509,6 +525,8 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -557,6 +575,8 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -605,6 +625,8 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -665,6 +687,8 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -709,6 +733,8 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -751,6 +777,8 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -793,6 +821,8 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -854,6 +884,8 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -901,6 +933,8 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -944,6 +978,8 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -987,6 +1023,8 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1051,6 +1089,8 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1097,6 +1137,8 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1140,6 +1182,8 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1186,6 +1230,8 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1232,6 +1278,8 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1278,6 +1326,8 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1321,6 +1371,8 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1392,6 +1444,8 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1456,6 +1510,8 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1506,6 +1562,8 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1553,6 +1611,8 @@ async def custom_named_request_id_head(self, *, foo_client_request_id: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py index 2a2c0459c63..fa4bd0f7291 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py @@ -694,6 +694,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -736,6 +738,8 @@ def param_get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -797,6 +801,8 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -840,6 +846,8 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -886,6 +894,8 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -929,6 +939,8 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -972,6 +984,8 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1038,6 +1052,8 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1086,6 +1102,8 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1134,6 +1152,8 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1182,6 +1202,8 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1242,6 +1264,8 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1286,6 +1310,8 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1328,6 +1354,8 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1370,6 +1398,8 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1431,6 +1461,8 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1478,6 +1510,8 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1521,6 +1555,8 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1564,6 +1600,8 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1628,6 +1666,8 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1674,6 +1714,8 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1717,6 +1759,8 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1763,6 +1807,8 @@ def get_method_query_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1809,6 +1855,8 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1853,6 +1901,8 @@ def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1896,6 +1946,8 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1967,6 +2019,8 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2031,6 +2085,8 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2081,6 +2137,8 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2128,6 +2186,8 @@ def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index fb35ccb2635..37d9c210da9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -91,6 +91,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 4ea7cce97af..c70f52c14d4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -107,6 +107,8 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py index f04d305ba06..a5d4e4082f9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py @@ -175,6 +175,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -257,6 +259,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -339,6 +343,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -421,6 +427,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -583,6 +591,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -666,6 +676,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -758,6 +770,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -841,6 +855,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -928,6 +944,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1012,6 +1030,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1104,6 +1124,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1199,6 +1221,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1282,6 +1306,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1365,6 +1391,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1447,6 +1475,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1529,6 +1559,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1611,6 +1643,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1697,6 +1731,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1783,6 +1819,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1822,7 +1860,8 @@ async def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1920,6 +1959,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2042,6 +2083,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2126,6 +2169,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2211,6 +2256,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py index 358c9076bfb..912ee4a284d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py @@ -617,6 +617,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -699,6 +701,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -781,6 +785,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -863,6 +869,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1023,6 +1031,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1106,6 +1116,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1198,6 +1210,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1281,6 +1295,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1368,6 +1384,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1452,6 +1470,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1544,6 +1564,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1639,6 +1661,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1722,6 +1746,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1805,6 +1831,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1887,6 +1915,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1969,6 +1999,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2051,6 +2083,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2135,6 +2169,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2221,6 +2257,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2260,7 +2298,8 @@ def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2357,6 +2396,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2479,6 +2520,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2563,6 +2606,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2648,6 +2693,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py index 8cb33ddeeb3..117a24cf0aa 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py @@ -129,6 +129,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -215,6 +217,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py index 5737e2c0232..2766e58cf1b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py @@ -178,6 +178,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -264,6 +266,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py index 725fd8efda9..e72f2fb00c2 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py @@ -88,6 +88,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -130,6 +132,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -172,6 +176,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py index d4d15f8c791..c7c6d4f860b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py index b47a7d90f71..292294369cd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py @@ -88,6 +88,8 @@ async def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -130,6 +132,8 @@ async def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -172,6 +176,8 @@ async def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py index 2b12b789432..6cc2b767b51 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py @@ -108,6 +108,8 @@ def head200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -150,6 +152,8 @@ def head204(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -192,6 +196,8 @@ def head404(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py index c5b62ed0883..8fa12590a34 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py @@ -228,6 +228,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -279,7 +281,8 @@ async def _update_qnas_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -659,6 +662,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py index a25a92b9798..8fbf7bb7c51 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py @@ -282,6 +282,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -333,7 +335,8 @@ def _update_qnas_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -713,6 +716,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 e2db6bbbb3e..37e3666eb2b 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 @@ -181,7 +181,8 @@ async def _put200_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -418,7 +419,8 @@ async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -661,7 +663,8 @@ async def _patch201_retry_with_async_header_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -903,7 +906,8 @@ async def _patch202_retry_with_async_and_location_header_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1146,7 +1150,8 @@ async def _put201_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1362,7 +1367,8 @@ async def _post202_list_initial(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1498,7 +1504,8 @@ async def _put200_succeeded_no_state_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1731,7 +1738,8 @@ async def _put202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1967,7 +1975,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2207,7 +2216,8 @@ async def _put200_updating_succeeded204_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2443,7 +2453,8 @@ async def _put201_creating_failed200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2683,7 +2694,8 @@ async def _put200_acceptedcanceled200_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2919,7 +2931,8 @@ async def _put_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3158,7 +3171,8 @@ async def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3408,7 +3422,8 @@ async def _put_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3656,7 +3671,8 @@ async def _put_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3906,7 +3922,8 @@ async def _put_async_no_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4154,7 +4171,8 @@ async def _put_async_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4400,7 +4418,8 @@ async def _put_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4579,7 +4598,8 @@ async def _put_async_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4758,7 +4778,8 @@ async def _put_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4958,7 +4979,8 @@ async def _put_async_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5143,7 +5165,8 @@ async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5261,7 +5284,8 @@ async def _delete_provisioning202_deleting_failed200_initial( # pylint: disable response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5379,7 +5403,8 @@ async def _delete_provisioning202_deletingcanceled200_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5495,7 +5520,8 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5575,7 +5601,8 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> AsyncIterator[byte response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5688,7 +5715,8 @@ async def _delete202_no_retry204_initial(self, **kwargs: Any) -> AsyncIterator[b response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5801,7 +5829,8 @@ async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> AsyncIterat response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5889,7 +5918,8 @@ async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> Async response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5977,7 +6007,8 @@ async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> AsyncIte response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6065,7 +6096,8 @@ async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> Async response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6153,7 +6185,8 @@ async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> AsyncIterat response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6241,7 +6274,8 @@ async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> AsyncItera response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6329,7 +6363,8 @@ async def _post200_with_payload_initial(self, **kwargs: Any) -> AsyncIterator[by response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6446,7 +6481,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6629,7 +6665,8 @@ async def _post202_no_retry204_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6855,7 +6892,8 @@ async def _post_double_headers_final_location_get_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6967,7 +7005,8 @@ async def _post_double_headers_final_azure_header_get_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7080,7 +7119,8 @@ async def _post_double_headers_final_azure_header_get_default_initial( # pylint response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7205,7 +7245,8 @@ async def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7452,7 +7493,8 @@ async def _post_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7699,7 +7741,8 @@ async def _post_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7888,7 +7931,8 @@ async def _post_async_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8095,7 +8139,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8335,7 +8380,8 @@ async def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8570,7 +8616,8 @@ async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8686,7 +8733,8 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> AsyncIterator[byte response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8773,7 +8821,8 @@ async def _delete_async_relative_retry_succeeded_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8880,7 +8929,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9063,7 +9113,8 @@ async def _post_async_relative_retry_succeeded_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9270,7 +9321,8 @@ async def _put_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9504,7 +9556,8 @@ async def _put_non_retry201_creating400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9741,7 +9794,8 @@ async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9978,7 +10032,8 @@ async def _put_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10208,7 +10263,8 @@ async def _delete_non_retry400_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10292,7 +10348,8 @@ async def _delete202_non_retry400_initial(self, **kwargs: Any) -> AsyncIterator[ response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10376,7 +10433,8 @@ async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> AsyncI response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10481,7 +10539,8 @@ async def _post_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10661,7 +10720,8 @@ async def _post202_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10841,7 +10901,8 @@ async def _post_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11027,7 +11088,8 @@ async def _put_error201_no_provisioning_state_payload_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11261,7 +11323,8 @@ async def _put_async_relative_retry_no_status_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11511,7 +11574,8 @@ async def _put_async_relative_retry_no_status_payload_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11744,7 +11808,8 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> AsyncIterator[byt response = pipeline_response.http_response if response.status_code not in [204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11826,7 +11891,8 @@ async def _delete_async_relative_retry_no_status_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11933,7 +11999,8 @@ async def _post202_no_location_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12116,7 +12183,8 @@ async def _post_async_relative_retry_no_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12305,7 +12373,8 @@ async def _put200_invalid_json_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12542,7 +12611,8 @@ async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12792,7 +12862,8 @@ async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13025,7 +13096,8 @@ async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> AsyncI response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13112,7 +13184,8 @@ async def _delete_async_relative_retry_invalid_header_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13204,7 +13277,8 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13311,7 +13385,8 @@ async def _post202_retry_invalid_header_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13494,7 +13569,8 @@ async def _post_async_relative_retry_invalid_header_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13683,7 +13759,8 @@ async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13890,7 +13967,8 @@ async def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14143,7 +14221,8 @@ async def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14386,7 +14465,8 @@ async def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14572,7 +14652,8 @@ async def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) 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 480d3c3f307..6743c121358 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 @@ -1449,7 +1449,8 @@ def _put200_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1686,7 +1687,8 @@ def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1929,7 +1931,8 @@ def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2170,7 +2173,8 @@ def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2413,7 +2417,8 @@ def _put201_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2629,7 +2634,8 @@ def _post202_list_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2761,7 +2767,8 @@ def _put200_succeeded_no_state_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -2994,7 +3001,8 @@ def _put202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3228,7 +3236,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3468,7 +3477,8 @@ def _put200_updating_succeeded204_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3704,7 +3714,8 @@ def _put201_creating_failed200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -3944,7 +3955,8 @@ def _put200_acceptedcanceled200_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4180,7 +4192,8 @@ def _put_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4419,7 +4432,8 @@ def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4669,7 +4683,8 @@ def _put_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -4917,7 +4932,8 @@ def _put_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5167,7 +5183,8 @@ def _put_async_no_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5415,7 +5432,8 @@ def _put_async_no_header_in_retry_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5659,7 +5677,8 @@ def _put_non_resource_initial(self, sku: Optional[Union[JSON, IO[bytes]]] = None response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -5836,7 +5855,8 @@ def _put_async_non_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6015,7 +6035,8 @@ def _put_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6215,7 +6236,8 @@ def _put_async_sub_resource_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6400,7 +6422,8 @@ def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6518,7 +6541,8 @@ def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6636,7 +6660,8 @@ def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6752,7 +6777,8 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6832,7 +6858,8 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -6945,7 +6972,8 @@ def _delete202_no_retry204_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7058,7 +7086,8 @@ def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7146,7 +7175,8 @@ def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> Iterator[by response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7234,7 +7264,8 @@ def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7322,7 +7353,8 @@ def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> Iterator[by response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7410,7 +7442,8 @@ def _delete_async_retry_failed_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7498,7 +7531,8 @@ def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7586,7 +7620,8 @@ def _post200_with_payload_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7703,7 +7738,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -7886,7 +7922,8 @@ def _post202_no_retry204_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8112,7 +8149,8 @@ def _post_double_headers_final_location_get_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8224,7 +8262,8 @@ def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8336,7 +8375,8 @@ def _post_double_headers_final_azure_header_get_default_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8461,7 +8501,8 @@ def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8708,7 +8749,8 @@ def _post_async_no_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -8955,7 +8997,8 @@ def _post_async_retry_failed_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9144,7 +9187,8 @@ def _post_async_retrycanceled_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9351,7 +9395,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9591,7 +9636,8 @@ def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9826,7 +9872,8 @@ def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -9942,7 +9989,8 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10029,7 +10077,8 @@ def _delete_async_relative_retry_succeeded_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10136,7 +10185,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10319,7 +10369,8 @@ def _post_async_relative_retry_succeeded_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10526,7 +10577,8 @@ def _put_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10760,7 +10812,8 @@ def _put_non_retry201_creating400_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -10997,7 +11050,8 @@ def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11234,7 +11288,8 @@ def _put_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11464,7 +11519,8 @@ def _delete_non_retry400_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11548,7 +11604,8 @@ def _delete202_non_retry400_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11632,7 +11689,8 @@ def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> Iterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11737,7 +11795,8 @@ def _post_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -11917,7 +11976,8 @@ def _post202_non_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12097,7 +12157,8 @@ def _post_async_relative_retry400_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12283,7 +12344,8 @@ def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12517,7 +12579,8 @@ def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -12767,7 +12830,8 @@ def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13000,7 +13064,8 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13082,7 +13147,8 @@ def _delete_async_relative_retry_no_status_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13189,7 +13255,8 @@ def _post202_no_location_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13372,7 +13439,8 @@ def _post_async_relative_retry_no_payload_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13561,7 +13629,8 @@ def _put200_invalid_json_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -13798,7 +13867,8 @@ def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14048,7 +14118,8 @@ def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14281,7 +14352,8 @@ def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> Iterator[byt response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14368,7 +14440,8 @@ def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14460,7 +14533,8 @@ def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14567,7 +14641,8 @@ def _post202_retry_invalid_header_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14750,7 +14825,8 @@ def _post_async_relative_retry_invalid_header_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -14939,7 +15015,8 @@ def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -15146,7 +15223,8 @@ def _put_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -15399,7 +15477,8 @@ def _put201_creating_succeeded200_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -15642,7 +15721,8 @@ def _post202_retry200_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -15828,7 +15908,8 @@ def _post_async_retry_succeeded_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py index 326129f11b5..32ca444cda8 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py @@ -114,7 +114,8 @@ def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -230,7 +231,8 @@ def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py index 902fd5ddddf..b8b4c0fe905 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py @@ -75,7 +75,8 @@ async def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -191,7 +192,8 @@ async def _poll_with_constant_parameterized_endpoints_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py index 12447337331..9990d872748 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py @@ -172,6 +172,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -254,6 +256,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -336,6 +340,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -418,6 +424,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -580,6 +588,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -663,6 +673,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -755,6 +767,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -838,6 +852,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -925,6 +941,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1009,6 +1027,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1101,6 +1121,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1196,6 +1218,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1279,6 +1303,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1362,6 +1388,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1444,6 +1472,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1526,6 +1556,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1608,6 +1640,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1694,6 +1728,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1780,6 +1816,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1819,7 +1857,8 @@ async def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1916,6 +1955,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2038,6 +2079,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2122,6 +2165,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2207,6 +2252,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py index 152ad69f9a6..572971c9945 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py @@ -614,6 +614,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -696,6 +698,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -778,6 +782,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -860,6 +866,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1020,6 +1028,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1103,6 +1113,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1195,6 +1207,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1278,6 +1292,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1365,6 +1381,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1449,6 +1467,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1541,6 +1561,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1636,6 +1658,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1719,6 +1743,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1802,6 +1828,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1884,6 +1912,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1966,6 +1996,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2048,6 +2080,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2132,6 +2166,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2218,6 +2254,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2257,7 +2295,8 @@ def _get_multiple_pages_lro_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2354,6 +2393,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2476,6 +2517,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2560,6 +2603,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2645,6 +2690,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py index cf293571446..658c1d16696 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py @@ -199,6 +199,8 @@ async def check_name_availability(self, account_name: Union[JSON, IO[bytes]], ** response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -258,7 +260,8 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -633,6 +636,8 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -737,6 +742,8 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1077,6 +1084,8 @@ async def update( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1143,6 +1152,8 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1273,6 +1284,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1401,6 +1414,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1566,6 +1581,8 @@ async def regenerate_key( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1652,6 +1669,8 @@ async def list(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py index 2d47035c23e..cd9b8e96dd7 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py @@ -467,6 +467,8 @@ def check_name_availability(self, account_name: Union[JSON, IO[bytes]], **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -526,7 +528,8 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -901,6 +904,8 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1005,6 +1010,8 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1345,6 +1352,8 @@ def update( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1411,6 +1420,8 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1541,6 +1552,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1669,6 +1682,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1834,6 +1849,8 @@ def regenerate_key( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -1920,6 +1937,8 @@ def list(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py index 3d87987dbbc..0502ed22771 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py @@ -99,6 +99,8 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py index 03f9d9946a5..23fd9a287d4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py @@ -130,6 +130,8 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py index f1c568faab5..0038e5e958b 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py @@ -171,6 +171,8 @@ def get_model(self, mode: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +314,8 @@ def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -392,6 +396,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -428,7 +434,8 @@ def _lro_initial(self, mode: str, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py index 2896d157829..79a478c4e4e 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py @@ -95,6 +95,8 @@ async def get_model(self, mode: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -240,6 +242,8 @@ async def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -320,6 +324,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -356,7 +362,8 @@ async def _lro_initial(self, mode: str, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py index f1c568faab5..0038e5e958b 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py @@ -171,6 +171,8 @@ def get_model(self, mode: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +314,8 @@ def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -392,6 +396,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -428,7 +434,8 @@ def _lro_initial(self, mode: str, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py index 2896d157829..79a478c4e4e 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py @@ -95,6 +95,8 @@ async def get_model(self, mode: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -240,6 +242,8 @@ async def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -320,6 +324,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -356,7 +362,8 @@ async def _lro_initial(self, mode: str, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py index bb5e84bb9a7..c82d55871bb 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py @@ -93,6 +93,8 @@ async def head_no_params(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -146,6 +148,8 @@ async def get_required(self, *, parameter: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +207,8 @@ async def put_required_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -314,6 +320,8 @@ async def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -367,6 +375,8 @@ async def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py index b571643db4b..7852daf0ef2 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py @@ -180,6 +180,8 @@ def head_no_params(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -233,6 +235,8 @@ def get_required(self, *, parameter: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -290,6 +294,8 @@ def put_required_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -399,6 +405,8 @@ def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any) -> J response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -452,6 +460,8 @@ def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py index 5b11e157edd..7366486b64f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py @@ -98,6 +98,8 @@ async def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -154,6 +156,8 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -219,6 +223,8 @@ async def put_required_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -333,6 +339,8 @@ async def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -383,6 +391,8 @@ async def delete_parameters(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -434,6 +444,8 @@ async def get_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -484,6 +496,8 @@ async def get_new_operation(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py index 90529a39e6b..7ee4091633a 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py @@ -219,6 +219,8 @@ def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -275,6 +277,8 @@ def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, * response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -340,6 +344,8 @@ def put_required_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -454,6 +460,8 @@ def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any) -> J response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -504,6 +512,8 @@ def delete_parameters(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -555,6 +565,8 @@ def get_optional( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -605,6 +617,8 @@ def get_new_operation(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py index 29292ff9595..04044111d15 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py @@ -163,6 +163,8 @@ def get_model(self, mode: str, **kwargs: Any) -> _models.Product: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -271,6 +273,8 @@ def post_model(self, mode: str, input: Union[_models.Input, IO[bytes]], **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -342,6 +346,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -378,7 +384,8 @@ def _lro_initial(self, mode: str, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py index af253a0f568..4519e9e332b 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py @@ -87,6 +87,8 @@ async def get_model(self, mode: str, **kwargs: Any) -> _models.Product: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -195,6 +197,8 @@ async def post_model(self, mode: str, input: Union[_models.Input, IO[bytes]], ** response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -266,6 +270,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -302,7 +308,8 @@ async def _lro_initial(self, mode: str, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py index 13d442b4680..3ce39b9aaaa 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py @@ -91,6 +91,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py index 0c689618199..d520fe189e5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py @@ -113,6 +113,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 a5ccb8a1c6e..760ea91ecbe 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 @@ -100,6 +100,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -152,7 +154,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -301,7 +304,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -396,6 +400,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -485,6 +491,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py index 87ce6450968..ecb3b5bd56b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py @@ -92,6 +92,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 818a077d7de..b5262f11b4b 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 @@ -178,6 +178,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -230,7 +232,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -471,6 +475,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -560,6 +566,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py index 03175ce8636..4f7696475b0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py @@ -114,6 +114,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py index f5664246d0b..4a8464b27f0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py @@ -87,6 +87,8 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,6 +147,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 de40b766092..7b76499245e 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 @@ -145,6 +145,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -193,6 +195,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py index 5ddeb353872..4c83170266a 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py @@ -97,6 +97,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index 8dee193b284..4aa00a81c18 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -136,6 +136,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -194,6 +196,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 7d8721d3196..b428ceed37c 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 @@ -189,6 +189,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -237,6 +239,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py index 853ab3e9695..7d7257f5451 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py @@ -118,6 +118,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py index 1a7a3cd9d32..20346552a27 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py @@ -112,6 +112,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -173,6 +175,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 24b5ccb8f48..56e11503887 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 @@ -126,6 +126,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -226,6 +228,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 9d0b7336040..b2d617a4bc5 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 @@ -146,6 +146,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -190,6 +192,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index c19af1cb11c..14648ca6628 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -155,6 +155,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 13a0e68cea8..1afce5f8d75 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 @@ -161,6 +161,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -261,6 +263,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 1e1e3e966df..316e6a1c5a6 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 @@ -190,6 +190,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -234,6 +236,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 c4bda441948..8e93c576085 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 @@ -100,6 +100,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -152,7 +154,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -301,7 +304,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -397,6 +401,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -486,6 +492,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py index 472e57f3e4b..6db37ef56d1 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py @@ -92,6 +92,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 cc023e91741..40ea1238ae2 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 @@ -178,6 +178,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -230,7 +232,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -472,6 +476,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -561,6 +567,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py index 870f9bc1da0..0841b347342 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py @@ -114,6 +114,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py index e2ed713d40c..8c05e86e208 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py @@ -87,6 +87,8 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,6 +147,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 bbfa3338d5d..aabcf05c17b 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 @@ -145,6 +145,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -193,6 +195,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py index a7cd2def87a..a64f0455077 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py @@ -97,6 +97,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py index 557eeebec81..deeb05dc695 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py @@ -136,6 +136,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -194,6 +196,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 2ef8991578f..90c9817236a 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 @@ -189,6 +189,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -237,6 +239,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py index 198c5defbaf..8553ff59e8d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py @@ -118,6 +118,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py index 8244681d5e9..3bc8bf90a28 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py @@ -113,6 +113,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -174,6 +176,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 8919f6e0d0a..83148a43558 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 @@ -127,6 +127,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -227,6 +229,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 ed16ef067d8..7d7e6fccd94 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 @@ -146,6 +146,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -190,6 +192,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py index 7445f757ec9..c33d9b3e554 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py @@ -155,6 +155,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 8386e049541..ef0eacd1d64 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 @@ -161,6 +161,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -261,6 +263,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 3c417542331..b785c33e1d0 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 @@ -190,6 +190,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -234,6 +236,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py index 3accba56bd6..670e2970625 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -87,6 +87,8 @@ async def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py index d8a524aa390..78030eb6522 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py @@ -110,6 +110,8 @@ def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py index a139772b1b2..9d75db26558 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -87,6 +87,8 @@ async def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py index 2c7c4f61bf3..89682526e61 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py @@ -110,6 +110,8 @@ def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 bc60022def3..6a9c3169018 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 @@ -99,6 +99,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -151,7 +153,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -300,7 +303,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -395,6 +399,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -484,6 +490,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py index 3a4e2a7ee7e..35cf7ac23a5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py @@ -91,6 +91,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 00e674c5246..94013e6c6cc 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 @@ -177,6 +177,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -229,7 +231,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -375,7 +378,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -470,6 +474,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -559,6 +565,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py index 7bd8fc6c5b2..40df8333152 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py @@ -113,6 +113,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py index 7c8cdc51b77..5eb15495ac9 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py @@ -86,6 +86,8 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -144,6 +146,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 724477ce9d8..46f6f34245f 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 @@ -144,6 +144,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +194,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py index c8b4f9907b9..13dacc29a09 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py @@ -96,6 +96,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py index ffe8fe8e207..034c0e279f2 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py @@ -135,6 +135,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -193,6 +195,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 a55e02b3c69..e2a98b227b6 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 @@ -188,6 +188,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +238,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py index 7858dfafb29..207ae5c0efe 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py @@ -117,6 +117,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py index 04a0b821bd2..616c854958c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py @@ -111,6 +111,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -172,6 +174,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 a6211e97775..9d64c12964f 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 @@ -125,6 +125,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +227,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 b274594d804..1083bcd3a3d 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 @@ -145,6 +145,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,6 +191,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py index 8ba89aae327..4e8bc6fb90f 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py @@ -154,6 +154,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -215,6 +217,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 8575058f46e..a4053c5b0df 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 @@ -160,6 +160,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -260,6 +262,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 d819ccd1327..83756a46c38 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 @@ -189,6 +189,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -233,6 +235,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 87e17c499d4..eb21b7f7c3e 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 @@ -99,6 +99,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -151,7 +153,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -301,7 +304,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -397,6 +401,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -486,6 +492,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py index 5bd3c60691a..1eeb7920156 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py @@ -91,6 +91,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 7c424cac919..d1efa8520c1 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 @@ -177,6 +177,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -229,7 +231,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -472,6 +476,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -561,6 +567,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py index a9371bbd216..05491c08710 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py @@ -113,6 +113,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py index e056929003d..da929ff9bee 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py @@ -86,6 +86,8 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -144,6 +146,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 0ad7a09bd2d..0382160c78e 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 @@ -144,6 +144,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +194,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py index fb8de884e1f..e9d1514c5de 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py @@ -96,6 +96,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py index 41a7e66bc4b..58388d75917 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py @@ -135,6 +135,8 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -193,6 +195,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 bcd90b082fb..86feb06ee7d 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 @@ -188,6 +188,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +238,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py index 41b013455fa..37a125c1521 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py @@ -119,6 +119,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py index 223df204be3..97703a13ce4 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py @@ -111,6 +111,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -173,6 +175,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 2888902b27f..fa070bf11aa 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 @@ -125,6 +125,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +227,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 bfd7f447185..f83a76df385 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 @@ -145,6 +145,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,6 +191,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py index fed3c4e5232..d28ff56b4b9 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py @@ -154,6 +154,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 726eec9555b..54d9568dca2 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 @@ -160,6 +160,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -260,6 +262,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 2276f09e303..83083d43add 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 @@ -189,6 +189,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -233,6 +235,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 f7aa2ee11e3..4a3defc1f17 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 @@ -178,6 +178,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -230,7 +232,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -471,6 +475,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -560,6 +566,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py index feeb9e65006..402f73f56a3 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py @@ -114,6 +114,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index cdab84657e6..dbeb0ecabc5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -136,6 +136,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -194,6 +196,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 16f15e0d899..9972212b323 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 @@ -189,6 +189,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -237,6 +239,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py index 778e5562b28..71e20b73c23 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py @@ -118,6 +118,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index bf8ec72e0a1..9450b403895 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -155,6 +155,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 f70638fe608..6aea8319610 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 @@ -161,6 +161,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -261,6 +263,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 95a3004a16b..a1d74190199 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 @@ -190,6 +190,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -234,6 +236,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py index acae54b8b60..e88a42149fa 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py @@ -90,6 +90,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py index e079386bca3..5d9e895f7c3 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py @@ -112,6 +112,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 2ad37bc331e..5310f51bef3 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 @@ -99,6 +99,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -151,7 +153,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -300,7 +303,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -395,6 +399,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -484,6 +490,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py index b14b550c215..42f5a57c152 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py @@ -91,6 +91,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 5d1d9bf1bea..94cfccef980 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 @@ -177,6 +177,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -229,7 +231,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -375,7 +378,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -470,6 +474,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -559,6 +565,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py index dff4e61d8a6..abf523f4020 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py @@ -113,6 +113,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 b34613ea017..bf6c84059fb 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 @@ -100,6 +100,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -152,7 +154,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -301,7 +304,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -397,6 +401,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -486,6 +492,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py index ff567a1236d..45282e90abe 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py @@ -92,6 +92,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 53765b9cf9a..c2fce6f66fa 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 @@ -178,6 +178,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -230,7 +232,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -376,7 +379,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -472,6 +476,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -561,6 +567,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py index 9c857f5f29d..40a3699fcdf 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py @@ -114,6 +114,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py index a85514ddcde..326ac1079e7 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py @@ -87,6 +87,8 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -145,6 +147,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 035b757512f..7e65bb7a8b6 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 @@ -145,6 +145,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -193,6 +195,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py index d3c8748902c..ff3aebc3161 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py @@ -97,6 +97,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index b85ada6a51d..1480b0dfb45 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -136,6 +136,8 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -194,6 +196,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 fd6d081b6ef..4f7cb9d147d 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 @@ -189,6 +189,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -237,6 +239,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py index ddde0b5e6c9..8e759e32863 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py @@ -118,6 +118,8 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py index 94cc82a546f..37fe9d2d6a3 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py @@ -113,6 +113,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -174,6 +176,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 a4ff282b298..654448924a9 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 @@ -127,6 +127,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -227,6 +229,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 7c872e97fae..087333854cc 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 @@ -146,6 +146,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -190,6 +192,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index a119ef3b1ed..1656e87ea52 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -155,6 +155,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -216,6 +218,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 f67c40c4308..59319005b19 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 @@ -161,6 +161,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -261,6 +263,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 6c1e8ca75dc..5833bd4deae 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 @@ -190,6 +190,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -234,6 +236,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py index 4636044eaa6..470ccc728e4 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py @@ -139,6 +139,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -191,6 +193,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -266,6 +270,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -357,6 +363,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -405,6 +413,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -460,7 +470,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -517,7 +528,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -683,6 +695,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -790,6 +804,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -846,6 +862,8 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -925,6 +943,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py index 8a6972ce19d..e85fdc4a511 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py @@ -184,6 +184,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -236,6 +238,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -311,6 +315,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -441,6 +447,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -489,6 +497,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -644,7 +654,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -701,7 +712,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -866,6 +878,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -973,6 +987,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1029,6 +1045,8 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1108,6 +1126,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py index 5725b811a77..5010fadcd4b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py @@ -101,6 +101,8 @@ async def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -153,7 +155,8 @@ async def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -303,7 +306,8 @@ async def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -399,6 +403,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -488,6 +494,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -553,6 +561,8 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py index aef2f3c2a68..3de2ae99201 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py @@ -199,6 +199,8 @@ def test_one( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -251,7 +253,8 @@ def _test_lro_initial( response = pipeline_response.http_response if response.status_code not in [200, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -398,7 +401,8 @@ def _test_lro_and_paging_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -494,6 +498,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -583,6 +589,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -648,6 +656,8 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py index 04ddddc369f..880e2a7b05c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py @@ -94,6 +94,8 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -152,6 +154,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -269,6 +273,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -317,6 +323,8 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -387,6 +395,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py index 202ec2b167c..045137f99cc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py @@ -200,6 +200,8 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -258,6 +260,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,6 +379,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -423,6 +429,8 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -493,6 +501,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py index 984fb88e61d..c42b77a26f8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py @@ -117,6 +117,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -179,6 +181,8 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -271,6 +275,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -371,6 +377,8 @@ async def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -493,6 +501,8 @@ async def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -537,6 +547,8 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py index fd500e0572f..08fc0dc3f18 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py @@ -235,6 +235,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -297,6 +299,8 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -389,6 +393,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -489,6 +495,8 @@ def test_two( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -611,6 +619,8 @@ def test_four( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -655,6 +665,8 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py index debad5d0357..64e151fd4fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py @@ -143,6 +143,8 @@ async def create_ap_true( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -237,6 +239,8 @@ async def create_cat_ap_true( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -331,6 +335,8 @@ async def create_ap_object( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -425,6 +431,8 @@ async def create_ap_string( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -519,6 +527,8 @@ async def create_ap_in_properties( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -619,6 +629,8 @@ async def create_ap_in_properties_with_ap_string( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py index 9b40aa5a6e3..af94a2198d5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py @@ -241,6 +241,8 @@ def create_ap_true( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -335,6 +337,8 @@ def create_cat_ap_true( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -429,6 +433,8 @@ def create_ap_object( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -523,6 +529,8 @@ def create_ap_string( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -617,6 +625,8 @@ def create_ap_in_properties( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -717,6 +727,8 @@ def create_ap_in_properties_with_ap_string( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py index 987700b1406..4bde3355ace 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py @@ -78,6 +78,8 @@ async def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -131,6 +133,8 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -172,6 +176,8 @@ async def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +231,8 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -266,6 +274,8 @@ async def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -319,6 +329,8 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py index 9637641fd66..a1dc5e39bef 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py @@ -158,6 +158,8 @@ def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -211,6 +213,8 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -252,6 +256,8 @@ def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -305,6 +311,8 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -346,6 +354,8 @@ def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -399,6 +409,8 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py index b38b0a595cb..c5e1cb7da20 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py @@ -159,6 +159,8 @@ async def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,6 +207,8 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -251,6 +255,8 @@ async def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -345,6 +351,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -387,6 +395,8 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -481,6 +491,8 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -523,6 +535,8 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -569,6 +583,8 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -615,6 +631,8 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -709,6 +727,8 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -751,6 +771,8 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -797,6 +819,8 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -843,6 +867,8 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -937,6 +963,8 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -979,6 +1007,8 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1025,6 +1055,8 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1071,6 +1103,8 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1165,6 +1199,8 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1207,6 +1243,8 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1253,6 +1291,8 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1299,6 +1339,8 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1393,6 +1435,8 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1435,6 +1479,8 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1481,6 +1527,8 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1527,6 +1575,8 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1621,6 +1671,8 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1663,6 +1715,8 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1758,6 +1812,8 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1800,6 +1856,8 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models. response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1895,6 +1953,8 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1937,6 +1997,8 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1983,6 +2045,8 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2030,6 +2094,8 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2127,6 +2193,8 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2169,6 +2237,8 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2215,6 +2285,8 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2309,6 +2381,8 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2351,6 +2425,8 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2397,6 +2473,8 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2444,6 +2522,8 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2541,6 +2621,8 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2583,6 +2665,8 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2629,6 +2713,8 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2676,6 +2762,8 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2773,6 +2861,8 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2815,6 +2905,8 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2909,6 +3001,8 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2952,6 +3046,8 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3049,6 +3145,8 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3091,6 +3189,8 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3138,6 +3238,8 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3184,6 +3286,8 @@ async def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3230,6 +3334,8 @@ async def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3277,6 +3383,8 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3324,6 +3432,8 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3371,6 +3481,8 @@ async def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3468,6 +3580,8 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3510,6 +3624,8 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3556,6 +3672,8 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3602,6 +3720,8 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3648,6 +3768,8 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3694,6 +3816,8 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3788,6 +3912,8 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3830,6 +3956,8 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3876,6 +4004,8 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3923,6 +4053,8 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3970,6 +4102,8 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4017,6 +4151,8 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4114,6 +4250,8 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py index 018e6d00c8d..61e68414662 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py @@ -1112,6 +1112,8 @@ def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1158,6 +1160,8 @@ def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1204,6 +1208,8 @@ def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1298,6 +1304,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1340,6 +1348,8 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1434,6 +1444,8 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1476,6 +1488,8 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1522,6 +1536,8 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1568,6 +1584,8 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1662,6 +1680,8 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1704,6 +1724,8 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1750,6 +1772,8 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1796,6 +1820,8 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1890,6 +1916,8 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1932,6 +1960,8 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1978,6 +2008,8 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2024,6 +2056,8 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2118,6 +2152,8 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2160,6 +2196,8 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2206,6 +2244,8 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2252,6 +2292,8 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2346,6 +2388,8 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2388,6 +2432,8 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2434,6 +2480,8 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2480,6 +2528,8 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2574,6 +2624,8 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2616,6 +2668,8 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2711,6 +2765,8 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2753,6 +2809,8 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.Enum0] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2848,6 +2906,8 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2890,6 +2950,8 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2936,6 +2998,8 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2983,6 +3047,8 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3080,6 +3146,8 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3122,6 +3190,8 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3168,6 +3238,8 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3262,6 +3334,8 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3304,6 +3378,8 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3350,6 +3426,8 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3397,6 +3475,8 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3494,6 +3574,8 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3536,6 +3618,8 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3582,6 +3666,8 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3629,6 +3715,8 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3726,6 +3814,8 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3768,6 +3858,8 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3862,6 +3954,8 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3905,6 +3999,8 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4002,6 +4098,8 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4044,6 +4142,8 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4091,6 +4191,8 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4137,6 +4239,8 @@ def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4183,6 +4287,8 @@ def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4230,6 +4336,8 @@ def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4277,6 +4385,8 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4324,6 +4434,8 @@ def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4421,6 +4533,8 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4463,6 +4577,8 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4509,6 +4625,8 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4555,6 +4673,8 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4601,6 +4721,8 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4647,6 +4769,8 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4741,6 +4865,8 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4783,6 +4909,8 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4829,6 +4957,8 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4876,6 +5006,8 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4923,6 +5055,8 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4970,6 +5104,8 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -5067,6 +5203,8 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py index dc306a0ccb1..9efc3c12768 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py @@ -159,6 +159,8 @@ async def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,6 +207,8 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -251,6 +255,8 @@ async def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -345,6 +351,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -387,6 +395,8 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -481,6 +491,8 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -523,6 +535,8 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -569,6 +583,8 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -615,6 +631,8 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -709,6 +727,8 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -751,6 +771,8 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -797,6 +819,8 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -843,6 +867,8 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -937,6 +963,8 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -979,6 +1007,8 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1025,6 +1055,8 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1071,6 +1103,8 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1165,6 +1199,8 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1207,6 +1243,8 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1253,6 +1291,8 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1299,6 +1339,8 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1393,6 +1435,8 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1435,6 +1479,8 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1481,6 +1527,8 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1527,6 +1575,8 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1621,6 +1671,8 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1663,6 +1715,8 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1758,6 +1812,8 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1800,6 +1856,8 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models. response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1895,6 +1953,8 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1937,6 +1997,8 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1983,6 +2045,8 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2030,6 +2094,8 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2127,6 +2193,8 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2169,6 +2237,8 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2215,6 +2285,8 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2309,6 +2381,8 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2351,6 +2425,8 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2397,6 +2473,8 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2444,6 +2522,8 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2541,6 +2621,8 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2583,6 +2665,8 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2629,6 +2713,8 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2676,6 +2762,8 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2773,6 +2861,8 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2815,6 +2905,8 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2909,6 +3001,8 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2952,6 +3046,8 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3049,6 +3145,8 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3091,6 +3189,8 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3138,6 +3238,8 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3184,6 +3286,8 @@ async def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3230,6 +3334,8 @@ async def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3277,6 +3383,8 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3324,6 +3432,8 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3371,6 +3481,8 @@ async def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3468,6 +3580,8 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3510,6 +3624,8 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3556,6 +3672,8 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3602,6 +3720,8 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3648,6 +3768,8 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3694,6 +3816,8 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3788,6 +3912,8 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3830,6 +3956,8 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3876,6 +4004,8 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3923,6 +4053,8 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3970,6 +4102,8 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4017,6 +4151,8 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4114,6 +4250,8 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py index 200bd5dc74e..36f5ddde96d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py @@ -1112,6 +1112,8 @@ def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1158,6 +1160,8 @@ def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1204,6 +1208,8 @@ def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1298,6 +1304,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1340,6 +1348,8 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1434,6 +1444,8 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1476,6 +1488,8 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1522,6 +1536,8 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1568,6 +1584,8 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1662,6 +1680,8 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1704,6 +1724,8 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1750,6 +1772,8 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1796,6 +1820,8 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1890,6 +1916,8 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1932,6 +1960,8 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1978,6 +2008,8 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2024,6 +2056,8 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2118,6 +2152,8 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2160,6 +2196,8 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2206,6 +2244,8 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2252,6 +2292,8 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2346,6 +2388,8 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2388,6 +2432,8 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2434,6 +2480,8 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2480,6 +2528,8 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2574,6 +2624,8 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2616,6 +2668,8 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2711,6 +2765,8 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2753,6 +2809,8 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.Enum0] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2848,6 +2906,8 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2890,6 +2950,8 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2936,6 +2998,8 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2983,6 +3047,8 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3080,6 +3146,8 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3122,6 +3190,8 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3168,6 +3238,8 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3262,6 +3334,8 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3304,6 +3378,8 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3350,6 +3426,8 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3397,6 +3475,8 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3494,6 +3574,8 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3536,6 +3618,8 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3582,6 +3666,8 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3629,6 +3715,8 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3726,6 +3814,8 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3768,6 +3858,8 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3862,6 +3954,8 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3905,6 +3999,8 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4002,6 +4098,8 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4044,6 +4142,8 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4091,6 +4191,8 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4137,6 +4239,8 @@ def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4183,6 +4287,8 @@ def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4230,6 +4336,8 @@ def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4277,6 +4385,8 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4324,6 +4434,8 @@ def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4421,6 +4533,8 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4463,6 +4577,8 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4509,6 +4625,8 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4555,6 +4673,8 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4601,6 +4721,8 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4647,6 +4769,8 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4741,6 +4865,8 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4783,6 +4909,8 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4829,6 +4957,8 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4876,6 +5006,8 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4923,6 +5055,8 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4970,6 +5104,8 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -5067,6 +5203,8 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py index 9d42d802646..c3e8fd4212c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py @@ -86,7 +86,8 @@ async def error_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py index dd425c3e267..6e254733009 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py @@ -96,6 +96,8 @@ async def file( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -146,6 +148,8 @@ async def binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py index 8608a8bdff3..46b6e1fc78e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py @@ -104,7 +104,8 @@ def error_stream(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py index 0c9fb873a84..1ce2a01cd3b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py @@ -125,6 +125,8 @@ def file(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -173,6 +175,8 @@ def binary(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py index 88030a3d50d..cc1246958df 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py @@ -94,6 +94,8 @@ async def get_true(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -146,6 +148,8 @@ async def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -188,6 +192,8 @@ async def get_false(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -240,6 +246,8 @@ async def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -282,6 +290,8 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -328,6 +338,8 @@ async def get_invalid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py index 9ce517036f3..71c38729c89 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py @@ -182,6 +182,8 @@ def get_true(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -234,6 +236,8 @@ def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -276,6 +280,8 @@ def get_false(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -328,6 +334,8 @@ def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -370,6 +378,8 @@ def get_null(self, **kwargs: Any) -> Optional[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -416,6 +426,8 @@ def get_invalid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py index 7f83a94d30f..69011d27547 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py @@ -93,6 +93,8 @@ async def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -139,6 +141,8 @@ async def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -185,6 +189,8 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -241,6 +247,8 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -283,6 +291,8 @@ async def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py index 61d29e62d62..3062479936d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py @@ -163,6 +163,8 @@ def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -209,6 +211,8 @@ def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -255,6 +259,8 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -309,6 +315,8 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -351,6 +359,8 @@ def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py index 23c3bfa0228..11eba8172ed 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py @@ -93,6 +93,8 @@ async def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -139,6 +141,8 @@ async def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -185,6 +189,8 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -241,6 +247,8 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -283,6 +291,8 @@ async def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py index 9192881e2c6..bea8c64da85 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py @@ -163,6 +163,8 @@ def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -209,6 +211,8 @@ def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -255,6 +259,8 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -309,6 +315,8 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -351,6 +359,8 @@ def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py index 951e5074cba..08194bed2cb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py @@ -93,6 +93,8 @@ async def get_valid(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -149,6 +151,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -191,6 +195,8 @@ async def get_empty(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -247,6 +253,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -289,6 +297,8 @@ async def get_not_provided(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py index 2f46fd2b307..1d56700898f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py @@ -95,6 +95,8 @@ async def get_valid(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +194,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -234,6 +238,8 @@ async def get_invalid(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -280,6 +286,8 @@ async def get_empty(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -326,6 +334,8 @@ async def get_null(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -372,6 +382,8 @@ async def get_not_provided(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py index 62d1c35b7b6..fbefde6e652 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py @@ -94,6 +94,8 @@ async def get_valid(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -150,6 +152,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +196,8 @@ async def get_empty(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -248,6 +254,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -290,6 +298,8 @@ async def get_null(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -336,6 +346,8 @@ async def get_not_provided(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py index cf7bfdd22ec..b817f0a36a0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py @@ -86,6 +86,8 @@ async def get_valid(self, **kwargs: Any) -> _models.MyBaseType: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py index 8384c7b9ef3..10d136e7b95 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py @@ -88,6 +88,8 @@ async def get_valid(self, **kwargs: Any) -> _models.Siamese: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,6 +191,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py index a0b5a7b8b14..a44b2e30b95 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py @@ -88,6 +88,8 @@ async def get_valid(self, **kwargs: Any) -> _models.Fish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -338,6 +340,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py index 3b4b655feb2..f66650e6ea6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py @@ -98,6 +98,8 @@ async def get_valid(self, **kwargs: Any) -> _models.Fish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -288,6 +290,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -330,6 +334,8 @@ async def get_dot_syntax(self, **kwargs: Any) -> _models.DotFish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -378,6 +384,8 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> _models.DotFis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -426,6 +434,8 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> _models.Dot response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -473,6 +483,8 @@ async def get_complicated(self, **kwargs: Any) -> _models.Salmon: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -570,6 +582,8 @@ async def put_complicated( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -660,6 +674,8 @@ async def put_missing_discriminator( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -835,6 +851,8 @@ async def put_valid_missing_required( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py index 2f7c4d64e6a..e8a386bb388 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py @@ -112,6 +112,8 @@ async def get_int(self, **kwargs: Any) -> _models.IntWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -207,6 +209,8 @@ async def put_int( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -249,6 +253,8 @@ async def get_long(self, **kwargs: Any) -> _models.LongWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -344,6 +350,8 @@ async def put_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -386,6 +394,8 @@ async def get_float(self, **kwargs: Any) -> _models.FloatWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -481,6 +491,8 @@ async def put_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -523,6 +535,8 @@ async def get_double(self, **kwargs: Any) -> _models.DoubleWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -621,6 +635,8 @@ async def put_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -663,6 +679,8 @@ async def get_bool(self, **kwargs: Any) -> _models.BooleanWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -758,6 +776,8 @@ async def put_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -800,6 +820,8 @@ async def get_string(self, **kwargs: Any) -> _models.StringWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -895,6 +917,8 @@ async def put_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -937,6 +961,8 @@ async def get_date(self, **kwargs: Any) -> _models.DateWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1032,6 +1058,8 @@ async def put_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1074,6 +1102,8 @@ async def get_date_time(self, **kwargs: Any) -> _models.DatetimeWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1171,6 +1201,8 @@ async def put_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1213,6 +1245,8 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> _models.Datetimerfc1123W response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1310,6 +1344,8 @@ async def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1352,6 +1388,8 @@ async def get_duration(self, **kwargs: Any) -> _models.DurationWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1408,6 +1446,8 @@ async def put_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1450,6 +1490,8 @@ async def get_byte(self, **kwargs: Any) -> _models.ByteWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1506,6 +1548,8 @@ async def put_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py index e7979b09a77..278ebaf5845 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py @@ -87,6 +87,8 @@ async def get_valid(self, **kwargs: Any) -> _models.ReadonlyObj: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -143,6 +145,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py index 24b748ba5fd..c95a4bc5942 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py @@ -166,6 +166,8 @@ def get_valid(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -222,6 +224,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -264,6 +268,8 @@ def get_empty(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -320,6 +326,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -362,6 +370,8 @@ def get_not_provided(self, **kwargs: Any) -> _models.ArrayWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py index 68a4530d02d..fdf786af8f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py @@ -183,6 +183,8 @@ def get_valid(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -280,6 +282,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -322,6 +326,8 @@ def get_invalid(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -368,6 +374,8 @@ def get_empty(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -414,6 +422,8 @@ def get_null(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -460,6 +470,8 @@ def get_not_provided(self, **kwargs: Any) -> _models.Basic: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py index 8224b8672bf..8e4b3155a3d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py @@ -180,6 +180,8 @@ def get_valid(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +238,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -278,6 +282,8 @@ def get_empty(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -334,6 +340,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -376,6 +384,8 @@ def get_null(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -422,6 +432,8 @@ def get_not_provided(self, **kwargs: Any) -> _models.DictionaryWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py index f14888007f4..8dd21700ca7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py @@ -104,6 +104,8 @@ def get_valid(self, **kwargs: Any) -> _models.MyBaseType: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py index c26cee01050..70dfd6aaff7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py @@ -122,6 +122,8 @@ def get_valid(self, **kwargs: Any) -> _models.Siamese: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -223,6 +225,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py index 1499cc266a0..fd21b44f17a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py @@ -122,6 +122,8 @@ def get_valid(self, **kwargs: Any) -> _models.Fish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -372,6 +374,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py index 57d5ea42cf2..1ef8a4cb749 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py @@ -229,6 +229,8 @@ def get_valid(self, **kwargs: Any) -> _models.Fish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -419,6 +421,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -461,6 +465,8 @@ def get_dot_syntax(self, **kwargs: Any) -> _models.DotFish: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -509,6 +515,8 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> _models.DotFishMarke response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -557,6 +565,8 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> _models.DotFishMa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -604,6 +614,8 @@ def get_complicated(self, **kwargs: Any) -> _models.Salmon: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -701,6 +713,8 @@ def put_complicated( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -791,6 +805,8 @@ def put_missing_discriminator( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -966,6 +982,8 @@ def put_valid_missing_required( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py index f3233a2c614..8d4bf93f1a2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py @@ -433,6 +433,8 @@ def get_int(self, **kwargs: Any) -> _models.IntWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -528,6 +530,8 @@ def put_int( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -570,6 +574,8 @@ def get_long(self, **kwargs: Any) -> _models.LongWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -665,6 +671,8 @@ def put_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -707,6 +715,8 @@ def get_float(self, **kwargs: Any) -> _models.FloatWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -802,6 +812,8 @@ def put_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -844,6 +856,8 @@ def get_double(self, **kwargs: Any) -> _models.DoubleWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -942,6 +956,8 @@ def put_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -984,6 +1000,8 @@ def get_bool(self, **kwargs: Any) -> _models.BooleanWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1079,6 +1097,8 @@ def put_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1121,6 +1141,8 @@ def get_string(self, **kwargs: Any) -> _models.StringWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1216,6 +1238,8 @@ def put_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1258,6 +1282,8 @@ def get_date(self, **kwargs: Any) -> _models.DateWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1353,6 +1379,8 @@ def put_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1395,6 +1423,8 @@ def get_date_time(self, **kwargs: Any) -> _models.DatetimeWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1492,6 +1522,8 @@ def put_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1534,6 +1566,8 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> _models.Datetimerfc1123Wrapper response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1631,6 +1665,8 @@ def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1673,6 +1709,8 @@ def get_duration(self, **kwargs: Any) -> _models.DurationWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1729,6 +1767,8 @@ def put_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1771,6 +1811,8 @@ def get_byte(self, **kwargs: Any) -> _models.ByteWrapper: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1827,6 +1869,8 @@ def put_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py index 4987e8fe229..14a565f7981 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py @@ -121,6 +121,8 @@ def get_valid(self, **kwargs: Any) -> _models.ReadonlyObj: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -177,6 +179,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py index 490ccc8e135..b69b3b2f82d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py @@ -97,6 +97,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -143,6 +145,8 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,6 +193,8 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -235,6 +241,8 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -290,6 +298,8 @@ async def put_max_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -332,6 +342,8 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -387,6 +399,8 @@ async def put_min_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -429,6 +443,8 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py index 8ff4e12d0e4..919c3fe5e14 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py @@ -209,6 +209,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -255,6 +257,8 @@ def get_invalid_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -301,6 +305,8 @@ def get_overflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -347,6 +353,8 @@ def get_underflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -402,6 +410,8 @@ def put_max_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -444,6 +454,8 @@ def get_max_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -499,6 +511,8 @@ def put_min_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -541,6 +555,8 @@ def get_min_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py index da2a6c4fe42..b5db6dd1d6c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py @@ -111,6 +111,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -157,6 +159,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -203,6 +207,8 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -249,6 +255,8 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -304,6 +312,8 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -358,6 +368,8 @@ async def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -400,6 +412,8 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -446,6 +460,8 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -495,6 +511,8 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -550,6 +568,8 @@ async def put_local_positive_offset_max_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -594,6 +614,8 @@ async def get_local_positive_offset_lowercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -642,6 +664,8 @@ async def get_local_positive_offset_uppercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -697,6 +721,8 @@ async def put_local_negative_offset_max_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -741,6 +767,8 @@ async def get_local_negative_offset_uppercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -789,6 +817,8 @@ async def get_local_negative_offset_lowercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -844,6 +874,8 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -886,6 +918,8 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -941,6 +975,8 @@ async def put_local_positive_offset_min_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -983,6 +1019,8 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1038,6 +1076,8 @@ async def put_local_negative_offset_min_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1080,6 +1120,8 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1126,6 +1168,8 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py index 071a2fb4b91..69da2a9ddad 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py @@ -444,6 +444,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -490,6 +492,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -536,6 +540,8 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -582,6 +588,8 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -637,6 +645,8 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -691,6 +701,8 @@ def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -733,6 +745,8 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -779,6 +793,8 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -828,6 +844,8 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -883,6 +901,8 @@ def put_local_positive_offset_max_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -927,6 +947,8 @@ def get_local_positive_offset_lowercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -975,6 +997,8 @@ def get_local_positive_offset_uppercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1030,6 +1054,8 @@ def put_local_negative_offset_max_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1074,6 +1100,8 @@ def get_local_negative_offset_uppercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1122,6 +1150,8 @@ def get_local_negative_offset_lowercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1177,6 +1207,8 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1219,6 +1251,8 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1274,6 +1308,8 @@ def put_local_positive_offset_min_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1316,6 +1352,8 @@ def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1371,6 +1409,8 @@ def put_local_negative_offset_min_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1413,6 +1453,8 @@ def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1459,6 +1501,8 @@ def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py index 1fb44c7a2ef..d271db7680c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py @@ -98,6 +98,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -144,6 +146,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -190,6 +194,8 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +242,8 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -291,6 +299,8 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -333,6 +343,8 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -379,6 +391,8 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -434,6 +448,8 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -476,6 +492,8 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py index c6695d6f437..33be6043d01 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py @@ -223,6 +223,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -269,6 +271,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -315,6 +319,8 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -361,6 +367,8 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -416,6 +424,8 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -458,6 +468,8 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -504,6 +516,8 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -559,6 +573,8 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -601,6 +617,8 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py index b9c52003fb5..60480b62223 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py @@ -155,6 +155,8 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -201,6 +203,8 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -295,6 +299,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -337,6 +343,8 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -383,6 +391,8 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -429,6 +439,8 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -475,6 +487,8 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -521,6 +535,8 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -615,6 +631,8 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -657,6 +675,8 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -703,6 +723,8 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -749,6 +771,8 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -843,6 +867,8 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -885,6 +911,8 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -931,6 +959,8 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -977,6 +1007,8 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1071,6 +1103,8 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1113,6 +1147,8 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1159,6 +1195,8 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1205,6 +1243,8 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1299,6 +1339,8 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1341,6 +1383,8 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1387,6 +1431,8 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1433,6 +1479,8 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1527,6 +1575,8 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1569,6 +1619,8 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1615,6 +1667,8 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1661,6 +1715,8 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1755,6 +1811,8 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1797,6 +1855,8 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1843,6 +1903,8 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1889,6 +1951,8 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1983,6 +2047,8 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2025,6 +2091,8 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2071,6 +2139,8 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2118,6 +2188,8 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2215,6 +2287,8 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2257,6 +2331,8 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2303,6 +2379,8 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2350,6 +2428,8 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2447,6 +2527,8 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2489,6 +2571,8 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2583,6 +2667,8 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2626,6 +2712,8 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2723,6 +2811,8 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2766,6 +2856,8 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2813,6 +2905,8 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2859,6 +2953,8 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, _models.Wi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2905,6 +3001,8 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2952,6 +3050,8 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, _models.Widget response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2999,6 +3099,8 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, _models.Widge response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3046,6 +3148,8 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3143,6 +3247,8 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3185,6 +3291,8 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3231,6 +3339,8 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3277,6 +3387,8 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3323,6 +3435,8 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3370,6 +3484,8 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3467,6 +3583,8 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3509,6 +3627,8 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3555,6 +3675,8 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3602,6 +3724,8 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3649,6 +3773,8 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3697,6 +3823,8 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3797,6 +3925,8 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py index b68cd28576d..8b0f2c741ea 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py @@ -1047,6 +1047,8 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1093,6 +1095,8 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1187,6 +1191,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1229,6 +1235,8 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1275,6 +1283,8 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1321,6 +1331,8 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1367,6 +1379,8 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1413,6 +1427,8 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1507,6 +1523,8 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1549,6 +1567,8 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1595,6 +1615,8 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1641,6 +1663,8 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1735,6 +1759,8 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1777,6 +1803,8 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1823,6 +1851,8 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1869,6 +1899,8 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1963,6 +1995,8 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2005,6 +2039,8 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2051,6 +2087,8 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2097,6 +2135,8 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2191,6 +2231,8 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2233,6 +2275,8 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2279,6 +2323,8 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2325,6 +2371,8 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2419,6 +2467,8 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2461,6 +2511,8 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2507,6 +2559,8 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2553,6 +2607,8 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2647,6 +2703,8 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2689,6 +2747,8 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2735,6 +2795,8 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2781,6 +2843,8 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2875,6 +2939,8 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2917,6 +2983,8 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2963,6 +3031,8 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3010,6 +3080,8 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3107,6 +3179,8 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3149,6 +3223,8 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3195,6 +3271,8 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3242,6 +3320,8 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3339,6 +3419,8 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3381,6 +3463,8 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3475,6 +3559,8 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3518,6 +3604,8 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3615,6 +3703,8 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3658,6 +3748,8 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3705,6 +3797,8 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3751,6 +3845,8 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, _models.Widget]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3797,6 +3893,8 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3844,6 +3942,8 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3891,6 +3991,8 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -3938,6 +4040,8 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, _models.Widget]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4035,6 +4139,8 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4077,6 +4183,8 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4123,6 +4231,8 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4169,6 +4279,8 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4215,6 +4327,8 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4262,6 +4376,8 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4359,6 +4475,8 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4401,6 +4519,8 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4447,6 +4567,8 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4494,6 +4616,8 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4541,6 +4665,8 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4589,6 +4715,8 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -4689,6 +4817,8 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py index d40897cf72d..37d3ab276d3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -93,6 +93,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -148,6 +150,8 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -190,6 +194,8 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -236,6 +242,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py index 9c1338c4946..41f519a32c1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py @@ -150,6 +150,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,6 +207,8 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -247,6 +251,8 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -293,6 +299,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py index ea63703086c..85b78369763 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py @@ -90,7 +90,8 @@ async def get_file(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -137,7 +138,8 @@ async def get_file_large(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -184,7 +186,8 @@ async def get_empty_file(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py index 9b3c73484c5..0dd22995979 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py @@ -132,7 +132,8 @@ def get_file(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -179,7 +180,8 @@ def get_file_large(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -226,7 +228,8 @@ def get_empty_file(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py index a1b289dab91..68c6ce7ba01 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py @@ -105,7 +105,8 @@ async def upload_file(self, file_content: IO[bytes], file_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -159,7 +160,8 @@ async def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -216,7 +218,8 @@ async def upload_files(self, file_content: List[IO[bytes]], **kwargs: Any) -> As response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py index 887face8bf8..3fac400ff64 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py @@ -151,7 +151,8 @@ def upload_file(self, file_content: IO[bytes], file_name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,7 +206,8 @@ def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> Iterat response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -262,7 +264,8 @@ def upload_files(self, file_content: List[IO[bytes]], **kwargs: Any) -> Iterator response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index 1bbc33cde7d..11e3cf50f1a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -130,6 +130,8 @@ async def update_pet_with_form( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 405]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -192,6 +194,8 @@ async def partial_constant_body( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index 68f3421cc04..049ca2b8a70 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -155,6 +155,8 @@ def update_pet_with_form( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 405]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -217,6 +219,8 @@ def partial_constant_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py index 364180d4c64..8f8e94e21d6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py @@ -103,6 +103,8 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -149,6 +151,8 @@ async def get_invalid(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -195,6 +199,8 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -241,6 +247,8 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -287,6 +295,8 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -333,6 +343,8 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -386,6 +398,8 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -435,6 +449,8 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -484,6 +500,8 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -533,6 +551,8 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -575,6 +595,8 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -630,6 +652,8 @@ async def put_unix_time_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -672,6 +696,8 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -718,6 +744,8 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py index 9112c9214be..849e8b26f44 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py @@ -302,6 +302,8 @@ def get_null(self, **kwargs: Any) -> Optional[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -348,6 +350,8 @@ def get_invalid(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -394,6 +398,8 @@ def get_overflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -440,6 +446,8 @@ def get_underflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -486,6 +494,8 @@ def get_overflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -532,6 +542,8 @@ def get_underflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -585,6 +597,8 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -634,6 +648,8 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -683,6 +699,8 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -732,6 +750,8 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -774,6 +794,8 @@ def get_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -829,6 +851,8 @@ def put_unix_time_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -871,6 +895,8 @@ def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -917,6 +943,8 @@ def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py index 7673f91057a..44f1d619801 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py @@ -112,6 +112,8 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -158,6 +160,8 @@ async def get_invalid_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -204,6 +208,8 @@ async def get_invalid_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -250,6 +256,8 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -305,6 +313,8 @@ async def put_big_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -347,6 +357,8 @@ async def get_big_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -402,6 +414,8 @@ async def put_big_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -444,6 +458,8 @@ async def get_big_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -498,6 +514,8 @@ async def put_big_double_positive_decimal( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -540,6 +558,8 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -594,6 +614,8 @@ async def put_big_double_negative_decimal( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -636,6 +658,8 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -691,6 +715,8 @@ async def put_big_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -733,6 +759,8 @@ async def get_big_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -787,6 +815,8 @@ async def put_big_decimal_positive_decimal( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -829,6 +859,8 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -883,6 +915,8 @@ async def put_big_decimal_negative_decimal( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -925,6 +959,8 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -980,6 +1016,8 @@ async def put_small_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1022,6 +1060,8 @@ async def get_small_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1077,6 +1117,8 @@ async def put_small_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1119,6 +1161,8 @@ async def get_small_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1174,6 +1218,8 @@ async def put_small_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1216,6 +1262,8 @@ async def get_small_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py index ab97512e079..f33eef32d57 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py @@ -460,6 +460,8 @@ def get_null(self, **kwargs: Any) -> Optional[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -506,6 +508,8 @@ def get_invalid_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -552,6 +556,8 @@ def get_invalid_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -598,6 +604,8 @@ def get_invalid_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -653,6 +661,8 @@ def put_big_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -695,6 +705,8 @@ def get_big_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -750,6 +762,8 @@ def put_big_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -792,6 +806,8 @@ def get_big_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -844,6 +860,8 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -886,6 +904,8 @@ def get_big_double_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -938,6 +958,8 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -980,6 +1002,8 @@ def get_big_double_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1035,6 +1059,8 @@ def put_big_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1077,6 +1103,8 @@ def get_big_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1129,6 +1157,8 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1171,6 +1201,8 @@ def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1223,6 +1255,8 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1265,6 +1299,8 @@ def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1320,6 +1356,8 @@ def put_small_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1362,6 +1400,8 @@ def get_small_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1417,6 +1457,8 @@ def put_small_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1459,6 +1501,8 @@ def get_small_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1514,6 +1558,8 @@ def put_small_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1556,6 +1602,8 @@ def get_small_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py index b7d0d8273d0..e6d50203f8d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py @@ -94,6 +94,8 @@ async def get_not_expandable(self, **kwargs: Any) -> Union[str, _models.Colors]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -150,6 +152,8 @@ async def put_not_expandable( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +196,8 @@ async def get_referenced(self, **kwargs: Any) -> Union[str, _models.Colors]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -248,6 +254,8 @@ async def put_referenced( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -290,6 +298,8 @@ async def get_referenced_constant(self, **kwargs: Any) -> _models.RefColorConsta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -347,6 +357,8 @@ async def put_referenced_constant( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 7f3289f526a..dfd27242d60 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 @@ -101,6 +101,8 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -159,6 +161,8 @@ async def put_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -201,6 +205,8 @@ async def get_empty(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -253,6 +259,8 @@ async def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -295,6 +303,8 @@ async def get_mbcs(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -352,6 +362,8 @@ async def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -396,6 +408,8 @@ async def get_whitespace(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -452,6 +466,8 @@ async def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -494,6 +510,8 @@ async def get_not_provided(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -540,6 +558,8 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -586,6 +606,8 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -641,6 +663,8 @@ async def put_base64_url_encoded( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -683,6 +707,8 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py index bdc396f950d..a39723f725e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py @@ -184,6 +184,8 @@ def get_not_expandable(self, **kwargs: Any) -> Union[str, _models.Colors]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -240,6 +242,8 @@ def put_not_expandable( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -282,6 +286,8 @@ def get_referenced(self, **kwargs: Any) -> Union[str, _models.Colors]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -338,6 +344,8 @@ def put_referenced( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -380,6 +388,8 @@ def get_referenced_constant(self, **kwargs: Any) -> _models.RefColorConstant: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -437,6 +447,8 @@ def put_referenced_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 d51909a1b6f..0d664285bb6 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 @@ -297,6 +297,8 @@ def get_null(self, **kwargs: Any) -> Optional[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -355,6 +357,8 @@ def put_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -397,6 +401,8 @@ def get_empty(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -449,6 +455,8 @@ def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -491,6 +499,8 @@ def get_mbcs(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -548,6 +558,8 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -592,6 +604,8 @@ def get_whitespace(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -648,6 +662,8 @@ def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -690,6 +706,8 @@ def get_not_provided(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -736,6 +754,8 @@ def get_base64_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -782,6 +802,8 @@ def get_base64_url_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -837,6 +859,8 @@ def put_base64_url_encoded( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -879,6 +903,8 @@ def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py index 9a53b6ddd6b..e8493573b54 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py @@ -88,6 +88,8 @@ async def get(self, **kwargs: Any) -> datetime.time: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -141,6 +143,8 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py index 2ec5247b400..5c3e7e4c9d0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py @@ -122,6 +122,8 @@ def get(self, **kwargs: Any) -> datetime.time: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -175,6 +177,8 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py index fe93bc30370..f57ad26a2b1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py @@ -70,6 +70,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py index f06e292756c..13860fb368d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py @@ -87,6 +87,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py index 990108ac7af..7981f1108ad 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py @@ -114,6 +114,8 @@ async def put_no_model_as_string_no_required_two_value_no_default( # pylint: di response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -162,6 +164,8 @@ async def put_no_model_as_string_no_required_two_value_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -210,6 +214,8 @@ async def put_no_model_as_string_no_required_one_value_no_default( # pylint: di response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -258,6 +264,8 @@ async def put_no_model_as_string_no_required_one_value_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -306,6 +314,8 @@ async def put_no_model_as_string_required_two_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -354,6 +364,8 @@ async def put_no_model_as_string_required_two_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -401,6 +413,8 @@ async def put_no_model_as_string_required_one_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -448,6 +462,8 @@ async def put_no_model_as_string_required_one_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -496,6 +512,8 @@ async def put_model_as_string_no_required_two_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -544,6 +562,8 @@ async def put_model_as_string_no_required_two_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -592,6 +612,8 @@ async def put_model_as_string_no_required_one_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -640,6 +662,8 @@ async def put_model_as_string_no_required_one_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -688,6 +712,8 @@ async def put_model_as_string_required_two_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -736,6 +762,8 @@ async def put_model_as_string_required_two_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -784,6 +812,8 @@ async def put_model_as_string_required_one_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -832,6 +862,8 @@ async def put_model_as_string_required_one_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -877,6 +909,8 @@ async def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py index 3a5b560e0a8..278091de20e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py @@ -357,6 +357,8 @@ def put_no_model_as_string_no_required_two_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -405,6 +407,8 @@ def put_no_model_as_string_no_required_two_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -453,6 +457,8 @@ def put_no_model_as_string_no_required_one_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -501,6 +507,8 @@ def put_no_model_as_string_no_required_one_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -549,6 +557,8 @@ def put_no_model_as_string_required_two_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -597,6 +607,8 @@ def put_no_model_as_string_required_two_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -644,6 +656,8 @@ def put_no_model_as_string_required_one_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -691,6 +705,8 @@ def put_no_model_as_string_required_one_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -739,6 +755,8 @@ def put_model_as_string_no_required_two_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -787,6 +805,8 @@ def put_model_as_string_no_required_two_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -835,6 +855,8 @@ def put_model_as_string_no_required_one_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -883,6 +905,8 @@ def put_model_as_string_no_required_one_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -931,6 +955,8 @@ def put_model_as_string_required_two_value_no_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -979,6 +1005,8 @@ def put_model_as_string_required_two_value_default( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1027,6 +1055,8 @@ def put_model_as_string_required_one_value_no_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1075,6 +1105,8 @@ def put_model_as_string_required_one_value_default( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1120,6 +1152,8 @@ def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index e3a716bc790..7fed59ce996 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -94,6 +94,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 59776137c70..28f8d219ce4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -110,6 +110,8 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py index 106173196cd..ccf8951d94d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py @@ -106,6 +106,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py index d607a2a2a56..5672fc7b3c8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py @@ -137,6 +137,8 @@ def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py index 5c5efda5f37..35f0446b29b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py @@ -73,6 +73,8 @@ async def create_secret(self, **kwargs: Any) -> _models.SecretResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -119,6 +121,8 @@ async def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py index 6633a863ee3..413fad1e90a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py @@ -102,6 +102,8 @@ def create_secret(self, **kwargs: Any) -> _models.SecretResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -148,6 +150,8 @@ def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) 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 60c6db4093f..4e3fe29b6b2 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 @@ -91,6 +91,8 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> _models.Pet: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -185,6 +187,8 @@ async def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = Non response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 269968183dc..36ce9502a06 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 @@ -130,6 +130,8 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> _models.Pet: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -224,6 +226,8 @@ def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = None, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py index 49d77f0800b..9c4a3617bce 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py @@ -123,6 +123,8 @@ async def param_existing_key( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -165,6 +167,8 @@ async def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -212,6 +216,8 @@ async def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -254,6 +260,8 @@ async def response_protected_key(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -309,6 +317,8 @@ async def param_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -357,6 +367,8 @@ async def response_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -412,6 +424,8 @@ async def param_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -460,6 +474,8 @@ async def response_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -515,6 +531,8 @@ async def param_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -563,6 +581,8 @@ async def response_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -618,6 +638,8 @@ async def param_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -666,6 +688,8 @@ async def response_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -721,6 +745,8 @@ async def param_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -769,6 +795,8 @@ async def response_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -825,6 +853,8 @@ async def param_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -873,6 +903,8 @@ async def response_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -927,6 +959,8 @@ async def param_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -974,6 +1008,8 @@ async def response_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1029,6 +1065,8 @@ async def param_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1076,6 +1114,8 @@ async def response_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1131,6 +1171,8 @@ async def param_datetime_rfc1123( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1179,6 +1221,8 @@ async def response_datetime_rfc1123( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1232,6 +1276,8 @@ async def param_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1279,6 +1325,8 @@ async def response_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1332,6 +1380,8 @@ async def param_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1379,6 +1429,8 @@ async def response_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1435,6 +1487,8 @@ async def param_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1483,6 +1537,8 @@ async def response_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1529,6 +1585,8 @@ async def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py index c960f8c6ad8..c7eaec9f653 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py @@ -549,6 +549,8 @@ def param_existing_key( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -591,6 +593,8 @@ def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -638,6 +642,8 @@ def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -680,6 +686,8 @@ def response_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -735,6 +743,8 @@ def param_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -781,6 +791,8 @@ def response_integer(self, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -836,6 +848,8 @@ def param_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -882,6 +896,8 @@ def response_long(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -937,6 +953,8 @@ def param_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -983,6 +1001,8 @@ def response_float(self, scenario: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1038,6 +1058,8 @@ def param_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1084,6 +1106,8 @@ def response_double(self, scenario: str, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1139,6 +1163,8 @@ def param_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1185,6 +1211,8 @@ def response_bool(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1241,6 +1269,8 @@ def param_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1287,6 +1317,8 @@ def response_string(self, scenario: str, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1341,6 +1373,8 @@ def param_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1386,6 +1420,8 @@ def response_date(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1441,6 +1477,8 @@ def param_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1486,6 +1524,8 @@ def response_datetime(self, scenario: str, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1541,6 +1581,8 @@ def param_datetime_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1589,6 +1631,8 @@ def response_datetime_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1642,6 +1686,8 @@ def param_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1687,6 +1733,8 @@ def response_duration(self, scenario: str, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1740,6 +1788,8 @@ def param_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1785,6 +1835,8 @@ def response_byte(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1841,6 +1893,8 @@ def param_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1887,6 +1941,8 @@ def response_enum(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1933,6 +1989,8 @@ def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 fc6e6a834c2..d2e8805a4ea 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 @@ -114,6 +114,8 @@ async def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -156,6 +158,8 @@ async def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -198,6 +202,8 @@ async def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -253,6 +259,8 @@ async def put400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -308,6 +316,8 @@ async def patch400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -363,6 +373,8 @@ async def post400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -418,6 +430,8 @@ async def delete400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -460,6 +474,8 @@ async def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -502,6 +518,8 @@ async def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -544,6 +562,8 @@ async def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -586,6 +606,8 @@ async def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -641,6 +663,8 @@ async def put404( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -696,6 +720,8 @@ async def patch405( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -751,6 +777,8 @@ async def post406( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -806,6 +834,8 @@ async def delete407( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -861,6 +891,8 @@ async def put409( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -903,6 +935,8 @@ async def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -945,6 +979,8 @@ async def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -987,6 +1023,8 @@ async def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1029,6 +1067,8 @@ async def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1084,6 +1124,8 @@ async def put413( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1139,6 +1181,8 @@ async def patch414( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1194,6 +1238,8 @@ async def post415( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1236,6 +1282,8 @@ async def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1291,6 +1339,8 @@ async def delete417( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1333,6 +1383,8 @@ async def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py index 5a06cc2b45b..4b82cf31a06 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py @@ -90,6 +90,8 @@ async def get_empty_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -136,6 +138,8 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -181,6 +185,8 @@ async def get_no_model_empty(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 56e277a5c79..61cb92b8235 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 @@ -104,6 +104,8 @@ async def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -150,6 +152,8 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -201,6 +205,8 @@ async def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -247,6 +253,8 @@ async def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -307,6 +315,8 @@ async def put301( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -352,6 +362,8 @@ async def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -398,6 +410,8 @@ async def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -458,6 +472,8 @@ async def patch302( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -517,6 +533,8 @@ async def post303( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 303]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -563,6 +581,8 @@ async def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -609,6 +629,8 @@ async def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -655,6 +677,8 @@ async def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -714,6 +738,8 @@ async def put307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -773,6 +799,8 @@ async def patch307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -832,6 +860,8 @@ async def post307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -891,6 +921,8 @@ async def delete307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 dd8514bb394..e1c9dad48ee 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 @@ -97,6 +97,8 @@ async def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -152,6 +154,8 @@ async def put500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -207,6 +211,8 @@ async def patch500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -249,6 +255,8 @@ async def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -291,6 +299,8 @@ async def options502(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -350,6 +360,8 @@ async def post503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -405,6 +417,8 @@ async def delete503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -460,6 +474,8 @@ async def put504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -515,6 +531,8 @@ async def patch504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 4f9fe36fe13..acdc6a7a9d6 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 @@ -92,6 +92,8 @@ async def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -134,6 +136,8 @@ async def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -189,6 +193,8 @@ async def post505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -244,6 +250,8 @@ async def delete505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 4522dcecbbe..fc539a10932 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 @@ -107,6 +107,8 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -149,6 +151,8 @@ async def get200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -195,6 +199,8 @@ async def options200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -254,6 +260,8 @@ async def put200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -309,6 +317,8 @@ async def patch200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -364,6 +374,8 @@ async def post200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -419,6 +431,8 @@ async def delete200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -474,6 +488,8 @@ async def put201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -529,6 +545,8 @@ async def post201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -584,6 +602,8 @@ async def put202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -639,6 +659,8 @@ async def patch202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -694,6 +716,8 @@ async def post202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -749,6 +773,8 @@ async def delete202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -791,6 +817,8 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -846,6 +874,8 @@ async def put204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -901,6 +931,8 @@ async def patch204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -956,6 +988,8 @@ async def post204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1011,6 +1045,8 @@ async def delete204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1053,6 +1089,8 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py index 0c5d068f5eb..d667dc20239 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py @@ -123,6 +123,8 @@ async def get200_model204_no_model_default_error200_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -173,6 +175,8 @@ async def get200_model204_no_model_default_error204_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -223,6 +227,8 @@ async def get200_model204_no_model_default_error201_invalid( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -273,6 +279,8 @@ async def get200_model204_no_model_default_error202_none( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -323,6 +331,8 @@ async def get200_model204_no_model_default_error400_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -373,6 +383,8 @@ async def get200_model201_model_default_error200_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -425,6 +437,8 @@ async def get200_model201_model_default_error201_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -477,6 +491,8 @@ async def get200_model201_model_default_error400_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -530,6 +546,8 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -586,6 +604,8 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -642,6 +662,8 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -698,6 +720,8 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -753,6 +777,8 @@ async def get202_none204_none_default_error202_none( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -797,6 +823,8 @@ async def get202_none204_none_default_error204_none( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -841,6 +869,8 @@ async def get202_none204_none_default_error400_valid( # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -885,6 +915,8 @@ async def get202_none204_none_default_none202_invalid( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -928,6 +960,8 @@ async def get202_none204_none_default_none204_none( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -971,6 +1005,8 @@ async def get202_none204_none_default_none400_none( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1014,6 +1050,8 @@ async def get202_none204_none_default_none400_invalid( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1055,6 +1093,8 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> _models.MyExcepti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1100,6 +1140,8 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> _models.MyExceptio response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1147,6 +1189,8 @@ async def get_default_model_a400_valid( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.MyException, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1191,6 +1235,8 @@ async def get_default_model_a400_none( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.MyException, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1235,6 +1281,8 @@ async def get_default_none200_invalid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1276,6 +1324,8 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1319,6 +1369,8 @@ async def get_default_none400_invalid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1360,6 +1412,8 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1402,6 +1456,8 @@ async def get200_model_a200_none(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1447,6 +1503,8 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1492,6 +1550,8 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1537,6 +1597,8 @@ async def get200_model_a400_none(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1582,6 +1644,8 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1627,6 +1691,8 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1672,6 +1738,8 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 b4411001057..b79dfaaa392 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 @@ -493,6 +493,8 @@ def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -535,6 +537,8 @@ def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -577,6 +581,8 @@ def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -632,6 +638,8 @@ def put400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -687,6 +695,8 @@ def patch400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -742,6 +752,8 @@ def post400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -797,6 +809,8 @@ def delete400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -839,6 +853,8 @@ def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -881,6 +897,8 @@ def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -923,6 +941,8 @@ def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -965,6 +985,8 @@ def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1020,6 +1042,8 @@ def put404( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1075,6 +1099,8 @@ def patch405( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1130,6 +1156,8 @@ def post406( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1185,6 +1213,8 @@ def delete407( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1240,6 +1270,8 @@ def put409( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1282,6 +1314,8 @@ def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1324,6 +1358,8 @@ def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1366,6 +1402,8 @@ def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1408,6 +1446,8 @@ def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1463,6 +1503,8 @@ def put413( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1518,6 +1560,8 @@ def patch414( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1573,6 +1617,8 @@ def post415( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1615,6 +1661,8 @@ def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1670,6 +1718,8 @@ def delete417( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1712,6 +1762,8 @@ def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py index cbe714c5dce..80e704ba800 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py @@ -132,6 +132,8 @@ def get_empty_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -178,6 +180,8 @@ def get_no_model_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -223,6 +227,8 @@ def get_no_model_empty(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 f9ae0a73549..a84dd083e49 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 @@ -335,6 +335,8 @@ def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -381,6 +383,8 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -432,6 +436,8 @@ def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -478,6 +484,8 @@ def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -538,6 +546,8 @@ def put301( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -583,6 +593,8 @@ def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -629,6 +641,8 @@ def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -689,6 +703,8 @@ def patch302( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -748,6 +764,8 @@ def post303( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 303]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -794,6 +812,8 @@ def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -840,6 +860,8 @@ def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -886,6 +908,8 @@ def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -945,6 +969,8 @@ def put307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1004,6 +1030,8 @@ def patch307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1063,6 +1091,8 @@ def post307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1122,6 +1152,8 @@ def delete307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 338148712f5..c3602d27649 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 @@ -234,6 +234,8 @@ def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -289,6 +291,8 @@ def put500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -344,6 +348,8 @@ def patch500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -386,6 +392,8 @@ def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -428,6 +436,8 @@ def options502(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -487,6 +497,8 @@ def post503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -542,6 +554,8 @@ def delete503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -597,6 +611,8 @@ def put504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -652,6 +668,8 @@ def patch504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 87f178b0d38..e894d973c16 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 @@ -152,6 +152,8 @@ def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -194,6 +196,8 @@ def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -249,6 +253,8 @@ def post505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -304,6 +310,8 @@ def delete505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 625659808a0..32c9d5ad20a 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 @@ -398,6 +398,8 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -440,6 +442,8 @@ def get200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -486,6 +490,8 @@ def options200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -545,6 +551,8 @@ def put200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -600,6 +608,8 @@ def patch200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -655,6 +665,8 @@ def post200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -710,6 +722,8 @@ def delete200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -765,6 +779,8 @@ def put201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -820,6 +836,8 @@ def post201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -875,6 +893,8 @@ def put202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -930,6 +950,8 @@ def patch202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -985,6 +1007,8 @@ def post202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1040,6 +1064,8 @@ def delete202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1082,6 +1108,8 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1137,6 +1165,8 @@ def put204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1192,6 +1222,8 @@ def patch204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1247,6 +1279,8 @@ def post204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1302,6 +1336,8 @@ def delete204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1344,6 +1380,8 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py index 906c61059c7..d2fd178f40f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py @@ -550,6 +550,8 @@ def get200_model204_no_model_default_error200_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -600,6 +602,8 @@ def get200_model204_no_model_default_error204_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -650,6 +654,8 @@ def get200_model204_no_model_default_error201_invalid( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -700,6 +706,8 @@ def get200_model204_no_model_default_error202_none( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -750,6 +758,8 @@ def get200_model204_no_model_default_error400_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -800,6 +810,8 @@ def get200_model201_model_default_error200_valid( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -852,6 +864,8 @@ def get200_model201_model_default_error201_valid( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -904,6 +918,8 @@ def get200_model201_model_default_error400_valid( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -957,6 +973,8 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1013,6 +1031,8 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1069,6 +1089,8 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1125,6 +1147,8 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1180,6 +1204,8 @@ def get202_none204_none_default_error202_none( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1224,6 +1250,8 @@ def get202_none204_none_default_error204_none( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1268,6 +1296,8 @@ def get202_none204_none_default_error400_valid( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1312,6 +1342,8 @@ def get202_none204_none_default_none202_invalid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1355,6 +1387,8 @@ def get202_none204_none_default_none204_none( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1398,6 +1432,8 @@ def get202_none204_none_default_none400_none( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1441,6 +1477,8 @@ def get202_none204_none_default_none400_invalid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1482,6 +1520,8 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1527,6 +1567,8 @@ def get_default_model_a200_none(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1572,6 +1614,8 @@ def get_default_model_a400_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.MyException, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1614,6 +1658,8 @@ def get_default_model_a400_none(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.MyException, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1656,6 +1702,8 @@ def get_default_none200_invalid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1697,6 +1745,8 @@ def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1738,6 +1788,8 @@ def get_default_none400_invalid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1779,6 +1831,8 @@ def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1821,6 +1875,8 @@ def get200_model_a200_none(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1866,6 +1922,8 @@ def get200_model_a200_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1911,6 +1969,8 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1956,6 +2016,8 @@ def get200_model_a400_none(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2001,6 +2063,8 @@ def get200_model_a400_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2046,6 +2110,8 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2091,6 +2157,8 @@ def get200_model_a202_valid(self, **kwargs: Any) -> _models.MyException: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py index df1be08b0c3..a4fefcfbf6a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py @@ -72,6 +72,8 @@ async def get_incorrect_error_from_server( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py index 3252ad86a7c..e70dd6893f9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py @@ -80,6 +80,8 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 187f7f3554c..8db00cd3d22 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 @@ -131,6 +131,8 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -232,6 +234,8 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -283,6 +287,8 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -336,6 +342,8 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -390,6 +398,8 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -463,6 +473,8 @@ async def _body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -515,6 +527,8 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 e37bbb23cd7..4e78cdd5ad4 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 @@ -246,6 +246,8 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -347,6 +349,8 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -398,6 +402,8 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -451,6 +457,8 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -505,6 +513,8 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -576,6 +586,8 @@ def _body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -628,6 +640,8 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 e670ec8bd63..ac42389451f 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 @@ -131,6 +131,8 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -232,6 +234,8 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -283,6 +287,8 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -336,6 +342,8 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -390,6 +398,8 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -503,6 +513,8 @@ async def body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -555,6 +567,8 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 ddf27db37ec..eb648cc1589 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 @@ -246,6 +246,8 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -347,6 +349,8 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -398,6 +402,8 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -451,6 +457,8 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -505,6 +513,8 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -618,6 +628,8 @@ def body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -670,6 +682,8 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py index 4c5093d9738..426d5ac5532 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py @@ -78,6 +78,8 @@ async def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py index 05fe73c9e6d..79b556256c3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py @@ -98,6 +98,8 @@ def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) 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 a81a418ed2d..17a232a716c 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 @@ -151,6 +151,8 @@ async def put_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -196,6 +198,8 @@ async def get_array(self, **kwargs: Any) -> List[_models.FlattenedProduct]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -310,6 +314,8 @@ async def put_wrapped_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -356,6 +362,8 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[_models.ProductWrapper] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -467,6 +475,8 @@ async def put_dictionary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -512,6 +522,8 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, _models.FlattenedProd response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -629,6 +641,8 @@ async def put_resource_collection( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -674,6 +688,8 @@ async def get_resource_collection(self, **kwargs: Any) -> _models.ResourceCollec response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -785,6 +801,8 @@ async def put_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -874,6 +892,8 @@ async def post_flattened_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -961,6 +981,8 @@ async def put_simple_product_with_grouping( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 efd3dea22a3..864101c9f60 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 @@ -324,6 +324,8 @@ def put_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -369,6 +371,8 @@ def get_array(self, **kwargs: Any) -> List[_models.FlattenedProduct]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -483,6 +487,8 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -529,6 +535,8 @@ def get_wrapped_array(self, **kwargs: Any) -> List[_models.ProductWrapper]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -640,6 +648,8 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -685,6 +695,8 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, _models.FlattenedProduct]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -802,6 +814,8 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -847,6 +861,8 @@ def get_resource_collection(self, **kwargs: Any) -> _models.ResourceCollection: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -958,6 +974,8 @@ def put_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1047,6 +1065,8 @@ def post_flattened_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1134,6 +1154,8 @@ def put_simple_product_with_grouping( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py index 0e70784f81f..7a27910483b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py @@ -85,6 +85,8 @@ async def get_horse(self, **kwargs: Any) -> _models.Horse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -174,6 +176,8 @@ async def put_horse(self, horse: Union[_models.Horse, IO[bytes]], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -219,6 +223,8 @@ async def get_pet(self, **kwargs: Any) -> _models.Pet: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -273,6 +279,8 @@ async def put_pet(self, name: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -318,6 +326,8 @@ async def get_feline(self, **kwargs: Any) -> _models.Feline: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -407,6 +417,8 @@ async def put_feline(self, feline: Union[_models.Feline, IO[bytes]], **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -452,6 +464,8 @@ async def get_cat(self, **kwargs: Any) -> _models.Cat: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -543,6 +557,8 @@ async def put_cat(self, cat: Union[_models.Cat, IO[bytes]], **kwargs: Any) -> st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -589,6 +605,8 @@ async def get_kitten(self, **kwargs: Any) -> _models.Kitten: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -683,6 +701,8 @@ async def put_kitten(self, kitten: Union[_models.Kitten, IO[bytes]], **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py index beed3088c2a..8e7d13771c6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py @@ -232,6 +232,8 @@ def get_horse(self, **kwargs: Any) -> _models.Horse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -321,6 +323,8 @@ def put_horse(self, horse: Union[_models.Horse, IO[bytes]], **kwargs: Any) -> st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -366,6 +370,8 @@ def get_pet(self, **kwargs: Any) -> _models.Pet: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -420,6 +426,8 @@ def put_pet(self, name: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -465,6 +473,8 @@ def get_feline(self, **kwargs: Any) -> _models.Feline: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -554,6 +564,8 @@ def put_feline(self, feline: Union[_models.Feline, IO[bytes]], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -599,6 +611,8 @@ def get_cat(self, **kwargs: Any) -> _models.Cat: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -690,6 +704,8 @@ def put_cat(self, cat: Union[_models.Cat, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -736,6 +752,8 @@ def get_kitten(self, **kwargs: Any) -> _models.Kitten: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -830,6 +848,8 @@ def put_kitten(self, kitten: Union[_models.Kitten, IO[bytes]], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 d4496e592eb..4e2d05b8466 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 @@ -96,6 +96,8 @@ async def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -141,6 +143,8 @@ async def get(self, **kwargs: Any) -> Union[float, _models.FloatEnum]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 6622ac08db8..edaf2884000 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 @@ -96,6 +96,8 @@ async def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwarg response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -141,6 +143,8 @@ async def get(self, **kwargs: Any) -> Union[int, _models.IntEnum]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 a636ab04db8..b4a4ae619b7 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 @@ -130,6 +130,8 @@ def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,6 +177,8 @@ def get(self, **kwargs: Any) -> Union[float, _models.FloatEnum]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 8660a2176c6..096a3ff56f7 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 @@ -130,6 +130,8 @@ def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,6 +177,8 @@ def get(self, **kwargs: Any) -> Union[int, _models.IntEnum]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py index 5fc71ff08a6..46a1c141444 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py @@ -72,6 +72,8 @@ async def get(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) @@ -127,6 +129,8 @@ async def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py index d1757051881..f864bb4bebc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py @@ -106,6 +106,8 @@ def get(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) @@ -161,6 +163,8 @@ def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize("object", pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py index 987700b1406..4bde3355ace 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py @@ -78,6 +78,8 @@ async def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -131,6 +133,8 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -172,6 +176,8 @@ async def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +231,8 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -266,6 +274,8 @@ async def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -319,6 +329,8 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py index 9637641fd66..a1dc5e39bef 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py @@ -158,6 +158,8 @@ def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -211,6 +213,8 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -252,6 +256,8 @@ def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -305,6 +311,8 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -346,6 +354,8 @@ def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -399,6 +409,8 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py index 1c0a3dfc1db..acaba671f66 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py @@ -103,6 +103,8 @@ async def update( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py index 9f6caf42567..75c698a544c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py @@ -126,6 +126,8 @@ def update( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py index 8a6cf8e14cd..bef061cb6d4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py @@ -72,6 +72,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py index 7f0e14e6169..2812639cd79 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py @@ -82,6 +82,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py index d04227ad2e7..ef7aafd47f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py @@ -78,6 +78,8 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -129,6 +131,8 @@ async def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py index f347e2c4ec7..ed7a8a0b9b8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py @@ -117,6 +117,8 @@ def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -168,6 +170,8 @@ def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 3ef77f29533..bcec8cd4664 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 @@ -122,6 +122,8 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -173,6 +175,8 @@ async def put_required_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -225,6 +229,8 @@ async def post_required_integer_parameter( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -279,6 +285,8 @@ async def post_optional_integer_parameter( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -332,6 +340,8 @@ async def post_required_integer_property( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -387,6 +397,8 @@ async def post_optional_integer_property( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -435,6 +447,8 @@ async def post_required_integer_header( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -482,6 +496,8 @@ async def post_optional_integer_header( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -534,6 +550,8 @@ async def post_required_string_parameter( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -588,6 +606,8 @@ async def post_optional_string_parameter( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -641,6 +661,8 @@ async def post_required_string_property( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -696,6 +718,8 @@ async def post_optional_string_property( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -744,6 +768,8 @@ async def post_required_string_header( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -791,6 +817,8 @@ async def post_optional_string_header( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -884,6 +912,8 @@ async def post_required_class_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -977,6 +1007,8 @@ async def post_optional_class_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1030,6 +1062,8 @@ async def post_required_class_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1085,6 +1119,8 @@ async def post_optional_class_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1178,6 +1214,8 @@ async def post_required_array_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1271,6 +1309,8 @@ async def post_optional_array_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1324,6 +1364,8 @@ async def post_required_array_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1379,6 +1421,8 @@ async def post_optional_array_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1427,6 +1471,8 @@ async def post_required_array_header( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1474,6 +1520,8 @@ async def post_optional_array_header( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 505901805ae..063f8985317 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 @@ -101,6 +101,8 @@ async def get_required_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -148,6 +150,8 @@ async def put_optional_query( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -195,6 +199,8 @@ async def put_optional_header( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -249,6 +255,8 @@ async def put_optional_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -300,6 +308,8 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -343,6 +353,8 @@ async def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -386,6 +398,8 @@ async def get_required_global_query(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -429,6 +443,8 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 2e8d0032d0d..86c9150fab2 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 @@ -517,6 +517,8 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -568,6 +570,8 @@ def put_required_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -620,6 +624,8 @@ def post_required_integer_parameter( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -674,6 +680,8 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -727,6 +735,8 @@ def post_required_integer_property( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -782,6 +792,8 @@ def post_optional_integer_property( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -830,6 +842,8 @@ def post_required_integer_header( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -877,6 +891,8 @@ def post_optional_integer_header( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -929,6 +945,8 @@ def post_required_string_parameter( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -983,6 +1001,8 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1036,6 +1056,8 @@ def post_required_string_property( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1091,6 +1113,8 @@ def post_optional_string_property( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1139,6 +1163,8 @@ def post_required_string_header( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1186,6 +1212,8 @@ def post_optional_string_header( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1279,6 +1307,8 @@ def post_required_class_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1372,6 +1402,8 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1425,6 +1457,8 @@ def post_required_class_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1480,6 +1514,8 @@ def post_optional_class_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1573,6 +1609,8 @@ def post_required_array_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1666,6 +1704,8 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1719,6 +1759,8 @@ def post_required_array_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1774,6 +1816,8 @@ def post_optional_array_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1822,6 +1866,8 @@ def post_required_array_header( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1869,6 +1915,8 @@ def post_optional_array_header( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 3bf72f48b85..d0c97128911 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 @@ -241,6 +241,8 @@ def get_required_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -288,6 +290,8 @@ def put_optional_query( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -335,6 +339,8 @@ def put_optional_header( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -389,6 +395,8 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -440,6 +448,8 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -483,6 +493,8 @@ def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -526,6 +538,8 @@ def get_required_global_query(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -569,6 +583,8 @@ def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py index 0e900a8b487..d81921e8e18 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py @@ -91,6 +91,8 @@ async def operation_one(self, parameter1: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py index bd1f75e3517..8096e6172f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py @@ -86,6 +86,8 @@ async def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -138,6 +140,8 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -198,6 +202,8 @@ async def operation_with_data_param(self, data: str, world: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -256,6 +262,8 @@ async def operation_with_files_param(self, files: IO[bytes], file_name: str, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -315,6 +323,8 @@ async def operation_with_url( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -364,6 +374,8 @@ async def reserved_enum(self, enum_parameter: Union[str, _models.MyEnum], **kwar response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py index 199e502cb3c..308681be4d7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py @@ -113,6 +113,8 @@ def operation_one(self, parameter1: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py index e396c7f7b9c..da0b7b41698 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py @@ -192,6 +192,8 @@ def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) -> JSO response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +246,8 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -304,6 +308,8 @@ def operation_with_data_param(self, data: str, world: str, **kwargs: Any) -> JSO response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -362,6 +368,8 @@ def operation_with_files_param(self, files: IO[bytes], file_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -421,6 +429,8 @@ def operation_with_url( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -470,6 +480,8 @@ def reserved_enum(self, enum_parameter: Union[str, _models.MyEnum], **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py index 21e621b9780..10cf8a5f34b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py @@ -69,6 +69,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py index 0e0de91451e..54b7e97bd34 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py @@ -79,6 +79,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py index 3c904b90c18..d2edbb1411e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py @@ -71,6 +71,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py index 564aa101ee1..54666a09a7d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py @@ -81,6 +81,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py index 2cbfe0b7f46..46ed9526712 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py @@ -69,6 +69,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py index 58b86daa461..dc7f39fc366 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py @@ -79,6 +79,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py index ed111812f91..9bcf8560fee 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py @@ -71,6 +71,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py index 076157923ca..4d90c61cf77 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py @@ -81,6 +81,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py index e454dd698a8..c45256242fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py @@ -116,6 +116,8 @@ async def get_all_with_values( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -183,6 +185,8 @@ async def get_global_query_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -250,6 +254,8 @@ async def get_global_and_local_query_null( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -316,6 +322,8 @@ async def get_local_path_item_query_null( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py index b714f401916..8361adddc19 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py @@ -117,6 +117,8 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -161,6 +163,8 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -205,6 +209,8 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -251,6 +257,8 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -295,6 +303,8 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -339,6 +349,8 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -383,6 +395,8 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -427,6 +441,8 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -471,6 +487,8 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -515,6 +533,8 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -559,6 +579,8 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -603,6 +625,8 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -649,6 +673,8 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -693,6 +719,8 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -740,6 +768,8 @@ async def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -788,6 +818,8 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -836,6 +868,8 @@ async def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -883,6 +917,8 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -927,6 +963,8 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -974,6 +1012,8 @@ async def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1018,6 +1058,8 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1066,6 +1108,8 @@ async def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1110,6 +1154,8 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1157,6 +1203,8 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1204,6 +1252,8 @@ async def base64_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1253,6 +1303,8 @@ async def array_csv_in_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1300,6 +1352,8 @@ async def unix_time_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py index 4c52bb0edaa..70b26351c2e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py @@ -126,6 +126,8 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -170,6 +172,8 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -217,6 +221,8 @@ async def get_boolean_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -261,6 +267,8 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -307,6 +315,8 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -354,6 +364,8 @@ async def get_int_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -398,6 +410,8 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -442,6 +456,8 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -489,6 +505,8 @@ async def get_long_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -533,6 +551,8 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -577,6 +597,8 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -624,6 +646,8 @@ async def float_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -668,6 +692,8 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -712,6 +738,8 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -759,6 +787,8 @@ async def double_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -805,6 +835,8 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -851,6 +883,8 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -895,6 +929,8 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -942,6 +978,8 @@ async def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -990,6 +1028,8 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1038,6 +1078,8 @@ async def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1086,6 +1128,8 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1130,6 +1174,8 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1177,6 +1223,8 @@ async def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1221,6 +1269,8 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1268,6 +1318,8 @@ async def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1314,6 +1366,8 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1361,6 +1415,8 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1410,6 +1466,8 @@ async def array_string_csv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1457,6 +1515,8 @@ async def array_string_csv_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1505,6 +1565,8 @@ async def array_string_csv_empty( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1554,6 +1616,8 @@ async def array_string_no_collection_format_empty( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1603,6 +1667,8 @@ async def array_string_ssv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1652,6 +1718,8 @@ async def array_string_tsv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1701,6 +1769,8 @@ async def array_string_pipes_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py index 37cfe28f109..05b846b6487 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py @@ -283,6 +283,8 @@ def get_all_with_values( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -350,6 +352,8 @@ def get_global_query_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -417,6 +421,8 @@ def get_global_and_local_query_null( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -483,6 +489,8 @@ def get_local_path_item_query_null( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py index ccadef37bad..d19d2392b76 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py @@ -628,6 +628,8 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -672,6 +674,8 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -716,6 +720,8 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -760,6 +766,8 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -804,6 +812,8 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -848,6 +858,8 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -892,6 +904,8 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -936,6 +950,8 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -980,6 +996,8 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1024,6 +1042,8 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1068,6 +1088,8 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1112,6 +1134,8 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1158,6 +1182,8 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1202,6 +1228,8 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1247,6 +1275,8 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1295,6 +1325,8 @@ def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1343,6 +1375,8 @@ def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1390,6 +1424,8 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1434,6 +1470,8 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1479,6 +1517,8 @@ def byte_null(self, byte_path: bytes, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1523,6 +1563,8 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1571,6 +1613,8 @@ def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1615,6 +1659,8 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1662,6 +1708,8 @@ def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1709,6 +1757,8 @@ def base64_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1758,6 +1808,8 @@ def array_csv_in_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1805,6 +1857,8 @@ def unix_time_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py index 2c01575eb71..5b5518aa69f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py @@ -770,6 +770,8 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -814,6 +816,8 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -861,6 +865,8 @@ def get_boolean_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -905,6 +911,8 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -949,6 +957,8 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -996,6 +1006,8 @@ def get_int_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1040,6 +1052,8 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1084,6 +1098,8 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1131,6 +1147,8 @@ def get_long_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1175,6 +1193,8 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1219,6 +1239,8 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1266,6 +1288,8 @@ def float_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1310,6 +1334,8 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1354,6 +1380,8 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1401,6 +1429,8 @@ def double_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1447,6 +1477,8 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1493,6 +1525,8 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1537,6 +1571,8 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1584,6 +1620,8 @@ def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1632,6 +1670,8 @@ def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1680,6 +1720,8 @@ def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1728,6 +1770,8 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1772,6 +1816,8 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1819,6 +1865,8 @@ def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1863,6 +1911,8 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1910,6 +1960,8 @@ def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1956,6 +2008,8 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2003,6 +2057,8 @@ def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2052,6 +2108,8 @@ def array_string_csv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2099,6 +2157,8 @@ def array_string_csv_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2147,6 +2207,8 @@ def array_string_csv_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2196,6 +2258,8 @@ def array_string_no_collection_format_empty( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2245,6 +2309,8 @@ def array_string_ssv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2294,6 +2360,8 @@ def array_string_tsv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2343,6 +2411,8 @@ def array_string_pipes_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py index de75938c733..2374956f354 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py @@ -95,6 +95,8 @@ async def array_string_multi_null( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -143,6 +145,8 @@ async def array_string_multi_empty( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -192,6 +196,8 @@ async def array_string_multi_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py index 2f7a8dc1a3d..17badce0a55 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py @@ -158,6 +158,8 @@ def array_string_multi_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -206,6 +208,8 @@ def array_string_multi_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -255,6 +259,8 @@ def array_string_multi_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) 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 8b1d7f0a2eb..e2ed7d7d96d 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 @@ -89,6 +89,8 @@ async def validation_of_method_parameters( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -218,6 +220,8 @@ async def validation_of_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -266,6 +270,8 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -360,6 +366,8 @@ async def post_with_constant_in_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 0627b6e1b8a..92ecdb0bb25 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 @@ -184,6 +184,8 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -313,6 +315,8 @@ def validation_of_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -361,6 +365,8 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -455,6 +461,8 @@ def post_with_constant_in_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py index 4a9bbd18e83..4949ea3dbc2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py @@ -122,6 +122,8 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithR response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -176,6 +178,8 @@ async def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -217,6 +221,8 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWit response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -271,6 +277,8 @@ async def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +320,8 @@ async def get_simple(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -367,6 +377,8 @@ async def put_simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -409,6 +421,8 @@ async def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -463,6 +477,8 @@ async def put_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -505,6 +521,8 @@ async def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -549,6 +567,8 @@ async def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -603,6 +623,8 @@ async def put_empty_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -644,6 +666,8 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -698,6 +722,8 @@ async def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -739,6 +765,8 @@ async def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -794,6 +822,8 @@ async def put_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -835,6 +865,8 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -890,6 +922,8 @@ async def put_root_list_single_item( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -931,6 +965,8 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -986,6 +1022,8 @@ async def put_empty_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1027,6 +1065,8 @@ async def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1081,6 +1121,8 @@ async def put_empty_child_element( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1124,6 +1166,8 @@ async def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1173,6 +1217,8 @@ async def get_service_properties(self, **kwargs: Any) -> _models.StorageServiceP response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1231,6 +1277,8 @@ async def put_service_properties( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1276,6 +1324,8 @@ async def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1337,6 +1387,8 @@ async def put_acls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1382,6 +1434,8 @@ async def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1438,6 +1492,8 @@ async def json_input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1479,6 +1535,8 @@ async def json_output(self, **kwargs: Any) -> _models.JSONOutput: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1525,6 +1583,8 @@ async def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1570,6 +1630,8 @@ async def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1626,6 +1688,8 @@ async def put_binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1668,6 +1732,8 @@ async def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1724,6 +1790,8 @@ async def put_uri( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py index 225523d4852..b41fd1d8636 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py @@ -615,6 +615,8 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithRefAndN response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -669,6 +671,8 @@ def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -710,6 +714,8 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWithRefAn response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -764,6 +770,8 @@ def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -805,6 +813,8 @@ def get_simple(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -860,6 +870,8 @@ def put_simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -902,6 +914,8 @@ def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -956,6 +970,8 @@ def put_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -998,6 +1014,8 @@ def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1042,6 +1060,8 @@ def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1096,6 +1116,8 @@ def put_empty_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1137,6 +1159,8 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1191,6 +1215,8 @@ def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1232,6 +1258,8 @@ def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1287,6 +1315,8 @@ def put_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1328,6 +1358,8 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1383,6 +1415,8 @@ def put_root_list_single_item( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1424,6 +1458,8 @@ def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1479,6 +1515,8 @@ def put_empty_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1520,6 +1558,8 @@ def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1574,6 +1614,8 @@ def put_empty_child_element( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1617,6 +1659,8 @@ def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1666,6 +1710,8 @@ def get_service_properties(self, **kwargs: Any) -> _models.StorageServicePropert response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1724,6 +1770,8 @@ def put_service_properties( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1769,6 +1817,8 @@ def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1830,6 +1880,8 @@ def put_acls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1875,6 +1927,8 @@ def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1931,6 +1985,8 @@ def json_input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1972,6 +2028,8 @@ def json_output(self, **kwargs: Any) -> _models.JSONOutput: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2018,6 +2076,8 @@ def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2063,6 +2123,8 @@ def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2119,6 +2181,8 @@ def put_binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2161,6 +2225,8 @@ def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2217,6 +2283,8 @@ def put_uri( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py index 5336d52e45c..4285e39cfbe 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py @@ -100,6 +100,8 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pe response = pipeline_response.http_response if response.status_code not in [200, 202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) @@ -156,6 +158,8 @@ async def do_something(self, what_action: str, **kwargs: Any) -> _models.PetActi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -215,6 +219,8 @@ async def has_models_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py index f25fd2cb90a..bfeb6a708dd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py @@ -157,6 +157,8 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pet]: response = pipeline_response.http_response if response.status_code not in [200, 202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) @@ -213,6 +215,8 @@ def do_something(self, what_action: str, **kwargs: Any) -> _models.PetAction: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -272,6 +276,8 @@ def has_models_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py index 31d7ca3b3d1..d1933dbff07 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py @@ -183,6 +183,8 @@ async def create_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwar response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -326,6 +328,8 @@ async def create_cat_ap_true(self, create_parameters: Union[JSON, IO[bytes]], ** response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -464,6 +468,8 @@ async def create_ap_object(self, create_parameters: Union[JSON, IO[bytes]], **kw response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -602,6 +608,8 @@ async def create_ap_string(self, create_parameters: Union[JSON, IO[bytes]], **kw response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -740,6 +748,8 @@ async def create_ap_in_properties(self, create_parameters: Union[JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -900,6 +910,8 @@ async def create_ap_in_properties_with_ap_string( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py index 93d5ef2ff43..a1b2bbb56af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py @@ -281,6 +281,8 @@ def create_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: An response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -424,6 +426,8 @@ def create_cat_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -562,6 +566,8 @@ def create_ap_object(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -700,6 +706,8 @@ def create_ap_string(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -838,6 +846,8 @@ def create_ap_in_properties(self, create_parameters: Union[JSON, IO[bytes]], **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -996,6 +1006,8 @@ def create_ap_in_properties_with_ap_string(self, create_parameters: Union[JSON, response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py index bb5cd06b70c..e0f4956ec13 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py @@ -158,6 +158,8 @@ def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -214,6 +216,8 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -255,6 +259,8 @@ def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -311,6 +317,8 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -352,6 +360,8 @@ def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -408,6 +418,8 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py index ee5a72ad150..cc4f9a4349d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py @@ -78,6 +78,8 @@ async def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -134,6 +136,8 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,6 +179,8 @@ async def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -231,6 +237,8 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -272,6 +280,8 @@ async def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -328,6 +338,8 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py index 018afb4ba9b..1d6d46a9be3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py @@ -165,6 +165,8 @@ async def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -221,6 +223,8 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -277,6 +281,8 @@ async def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -381,6 +387,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -430,6 +438,8 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -534,6 +544,8 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -583,6 +595,8 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -639,6 +653,8 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -695,6 +711,8 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -799,6 +817,8 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -848,6 +868,8 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -904,6 +926,8 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -960,6 +984,8 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1064,6 +1090,8 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1113,6 +1141,8 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1169,6 +1199,8 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1225,6 +1257,8 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1329,6 +1363,8 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1378,6 +1414,8 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1434,6 +1472,8 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1490,6 +1530,8 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1594,6 +1636,8 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1643,6 +1687,8 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1699,6 +1745,8 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1755,6 +1803,8 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1859,6 +1909,8 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1908,6 +1960,8 @@ async def get_enum_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2012,6 +2066,8 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2061,6 +2117,8 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2165,6 +2223,8 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2214,6 +2274,8 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2270,6 +2332,8 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2327,6 +2391,8 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2434,6 +2500,8 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2483,6 +2551,8 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2539,6 +2609,8 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2643,6 +2715,8 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2692,6 +2766,8 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2748,6 +2824,8 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2805,6 +2883,8 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2912,6 +2992,8 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2961,6 +3043,8 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3017,6 +3101,8 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3074,6 +3160,8 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3181,6 +3269,8 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3230,6 +3320,8 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3334,6 +3426,8 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3384,6 +3478,8 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3491,6 +3587,8 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3540,6 +3638,8 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3597,6 +3697,8 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3656,6 +3758,8 @@ async def get_complex_null(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3715,6 +3819,8 @@ async def get_complex_empty(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3775,6 +3881,8 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3835,6 +3943,8 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3895,6 +4005,8 @@ async def get_complex_valid(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4005,6 +4117,8 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4056,6 +4170,8 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4114,6 +4230,8 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4172,6 +4290,8 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4230,6 +4350,8 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4288,6 +4410,8 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4394,6 +4518,8 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4445,6 +4571,8 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4503,6 +4631,8 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4562,6 +4692,8 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4621,6 +4753,8 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4680,6 +4814,8 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4789,6 +4925,8 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py index 84ef7e1a847..a2eb5902abd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py @@ -1118,6 +1118,8 @@ def get_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1174,6 +1176,8 @@ def get_invalid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1230,6 +1234,8 @@ def get_empty(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1334,6 +1340,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1383,6 +1391,8 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1487,6 +1497,8 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1536,6 +1548,8 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1592,6 +1606,8 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1648,6 +1664,8 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1752,6 +1770,8 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1801,6 +1821,8 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1857,6 +1879,8 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1913,6 +1937,8 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2017,6 +2043,8 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2066,6 +2094,8 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2122,6 +2152,8 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2178,6 +2210,8 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2282,6 +2316,8 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2331,6 +2367,8 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2387,6 +2425,8 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2443,6 +2483,8 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2547,6 +2589,8 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2596,6 +2640,8 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2652,6 +2698,8 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2708,6 +2756,8 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2812,6 +2862,8 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2861,6 +2913,8 @@ def get_enum_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2965,6 +3019,8 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3014,6 +3070,8 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3118,6 +3176,8 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3167,6 +3227,8 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3223,6 +3285,8 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3280,6 +3344,8 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3387,6 +3453,8 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3436,6 +3504,8 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3492,6 +3562,8 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3596,6 +3668,8 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3645,6 +3719,8 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3701,6 +3777,8 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3758,6 +3836,8 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3865,6 +3945,8 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3914,6 +3996,8 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3970,6 +4054,8 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4027,6 +4113,8 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4134,6 +4222,8 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4183,6 +4273,8 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4287,6 +4379,8 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4337,6 +4431,8 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4444,6 +4540,8 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4493,6 +4591,8 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4550,6 +4650,8 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4609,6 +4711,8 @@ def get_complex_null(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4668,6 +4772,8 @@ def get_complex_empty(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4728,6 +4834,8 @@ def get_complex_item_null(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4788,6 +4896,8 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4848,6 +4958,8 @@ def get_complex_valid(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4958,6 +5070,8 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5009,6 +5123,8 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5067,6 +5183,8 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5125,6 +5243,8 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5183,6 +5303,8 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5241,6 +5363,8 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5347,6 +5471,8 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5398,6 +5524,8 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5456,6 +5584,8 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5515,6 +5645,8 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5574,6 +5706,8 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5633,6 +5767,8 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5742,6 +5878,8 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index f45e98179a6..53f4534d42c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -97,6 +97,8 @@ async def file( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -147,6 +149,8 @@ async def binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -206,7 +210,8 @@ async def error_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index 757349b257e..0030d36849a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -136,6 +136,8 @@ def file(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -184,6 +186,8 @@ def binary(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -243,7 +247,8 @@ def error_stream(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py index 300d22b3e24..9fba3a923d5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py @@ -91,6 +91,8 @@ async def get_true(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -145,6 +147,8 @@ async def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -186,6 +190,8 @@ async def get_false(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -240,6 +246,8 @@ async def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -281,6 +289,8 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -329,6 +339,8 @@ async def get_invalid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py index 5905353ceb0..f92d6abc705 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py @@ -179,6 +179,8 @@ def get_true(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -233,6 +235,8 @@ def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -274,6 +278,8 @@ def get_false(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -328,6 +334,8 @@ def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -369,6 +377,8 @@ def get_null(self, **kwargs: Any) -> Optional[bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -417,6 +427,8 @@ def get_invalid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py index 971a4725a53..b21c752eb2c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py @@ -90,6 +90,8 @@ async def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -138,6 +140,8 @@ async def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -186,6 +190,8 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +250,8 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -285,6 +293,8 @@ async def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py index 3b847d90d6c..48403d8627e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py @@ -160,6 +160,8 @@ def get_null(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -208,6 +210,8 @@ def get_empty(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -256,6 +260,8 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +318,8 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -353,6 +361,8 @@ def get_invalid(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py index 2ab02f001cd..bb2c0a74651 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py @@ -152,6 +152,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -270,6 +272,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -321,6 +325,8 @@ async def get_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -379,6 +385,8 @@ async def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -437,6 +445,8 @@ async def get_null(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -495,6 +505,8 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -570,6 +582,8 @@ async def get_int(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -684,6 +698,8 @@ async def put_int( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -734,6 +750,8 @@ async def get_long(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -849,6 +867,8 @@ async def put_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -899,6 +919,8 @@ async def get_float(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1014,6 +1036,8 @@ async def put_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1065,6 +1089,8 @@ async def get_double(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1185,6 +1211,8 @@ async def put_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1235,6 +1263,8 @@ async def get_bool(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1350,6 +1380,8 @@ async def put_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1401,6 +1433,8 @@ async def get_string(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1518,6 +1552,8 @@ async def put_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1568,6 +1604,8 @@ async def get_date(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1683,6 +1721,8 @@ async def put_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1733,6 +1773,8 @@ async def get_date_time(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1850,6 +1892,8 @@ async def put_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1900,6 +1944,8 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2017,6 +2063,8 @@ async def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2066,6 +2114,8 @@ async def get_duration(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2179,6 +2229,8 @@ async def put_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2228,6 +2280,8 @@ async def get_byte(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2343,6 +2397,8 @@ async def put_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2412,6 +2468,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2531,6 +2589,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2582,6 +2642,8 @@ async def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2699,6 +2761,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2750,6 +2814,8 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2826,6 +2892,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2946,6 +3014,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2997,6 +3067,8 @@ async def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3114,6 +3186,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3165,6 +3239,8 @@ async def get_null(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3223,6 +3299,8 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3307,6 +3385,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3446,6 +3526,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3566,6 +3648,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3880,6 +3964,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3938,6 +4024,8 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4024,6 +4112,8 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4110,6 +4200,8 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4181,6 +4273,8 @@ async def get_complicated(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4324,6 +4418,8 @@ async def put_complicated( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4515,6 +4611,8 @@ async def put_missing_discriminator(self, complex_body: Union[JSON, IO[bytes]], response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4814,6 +4912,8 @@ async def put_valid_missing_required( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4934,6 +5034,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5308,6 +5410,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5376,6 +5480,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5490,6 +5596,8 @@ async def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5568,6 +5676,8 @@ async def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py index e73db771d89..6a3420d2cd0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py @@ -949,6 +949,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1067,6 +1069,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1118,6 +1122,8 @@ def get_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1176,6 +1182,8 @@ def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1234,6 +1242,8 @@ def get_null(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1292,6 +1302,8 @@ def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1367,6 +1379,8 @@ def get_int(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1481,6 +1495,8 @@ def put_int( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1531,6 +1547,8 @@ def get_long(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1646,6 +1664,8 @@ def put_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1696,6 +1716,8 @@ def get_float(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1811,6 +1833,8 @@ def put_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1862,6 +1886,8 @@ def get_double(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1982,6 +2008,8 @@ def put_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2032,6 +2060,8 @@ def get_bool(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2147,6 +2177,8 @@ def put_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2198,6 +2230,8 @@ def get_string(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2315,6 +2349,8 @@ def put_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2365,6 +2401,8 @@ def get_date(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2480,6 +2518,8 @@ def put_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2530,6 +2570,8 @@ def get_date_time(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2647,6 +2689,8 @@ def put_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2697,6 +2741,8 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2814,6 +2860,8 @@ def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2863,6 +2911,8 @@ def get_duration(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2976,6 +3026,8 @@ def put_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3025,6 +3077,8 @@ def get_byte(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3140,6 +3194,8 @@ def put_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3209,6 +3265,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3328,6 +3386,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3379,6 +3439,8 @@ def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3496,6 +3558,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3547,6 +3611,8 @@ def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3623,6 +3689,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3743,6 +3811,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3794,6 +3864,8 @@ def get_empty(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3911,6 +3983,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3962,6 +4036,8 @@ def get_null(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4020,6 +4096,8 @@ def get_not_provided(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4104,6 +4182,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4243,6 +4323,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4363,6 +4445,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4677,6 +4761,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4735,6 +4821,8 @@ def get_dot_syntax(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4821,6 +4909,8 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4907,6 +4997,8 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4978,6 +5070,8 @@ def get_complicated(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5121,6 +5215,8 @@ def put_complicated( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5312,6 +5408,8 @@ def put_missing_discriminator(self, complex_body: Union[JSON, IO[bytes]], **kwar response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5611,6 +5709,8 @@ def put_valid_missing_required( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5731,6 +5831,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6105,6 +6207,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6173,6 +6277,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6287,6 +6393,8 @@ def put_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6365,6 +6473,8 @@ def get_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py index 6f50420f0fe..022f2664ada 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py @@ -95,6 +95,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -143,6 +145,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -191,6 +195,8 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -239,6 +245,8 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -296,6 +304,8 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -337,6 +347,8 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -385,6 +397,8 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -442,6 +456,8 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -483,6 +499,8 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py index 0a912fdb88e..bdd7477418b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py @@ -228,6 +228,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -276,6 +278,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -324,6 +328,8 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -372,6 +378,8 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -429,6 +437,8 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -470,6 +480,8 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -518,6 +530,8 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -575,6 +589,8 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -616,6 +632,8 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py index d46cc5ef59d..a40998c25c6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py @@ -108,6 +108,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -156,6 +158,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -204,6 +208,8 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -252,6 +258,8 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -309,6 +317,8 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -362,6 +372,8 @@ async def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -403,6 +415,8 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -451,6 +465,8 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -502,6 +518,8 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -559,6 +577,8 @@ async def put_local_positive_offset_max_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -602,6 +622,8 @@ async def get_local_positive_offset_lowercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -652,6 +674,8 @@ async def get_local_positive_offset_uppercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -709,6 +733,8 @@ async def put_local_negative_offset_max_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -752,6 +778,8 @@ async def get_local_negative_offset_uppercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -802,6 +830,8 @@ async def get_local_negative_offset_lowercase_max_date_time( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -859,6 +889,8 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -900,6 +932,8 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -957,6 +991,8 @@ async def put_local_positive_offset_min_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -998,6 +1034,8 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1055,6 +1093,8 @@ async def put_local_negative_offset_min_date_time( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1096,6 +1136,8 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1144,6 +1186,8 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py index b2e720520ff..0137a9edd50 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py @@ -451,6 +451,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -499,6 +501,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -547,6 +551,8 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -595,6 +601,8 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -652,6 +660,8 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -705,6 +715,8 @@ def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -746,6 +758,8 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -794,6 +808,8 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -845,6 +861,8 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -902,6 +920,8 @@ def put_local_positive_offset_max_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -945,6 +965,8 @@ def get_local_positive_offset_lowercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -995,6 +1017,8 @@ def get_local_positive_offset_uppercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1052,6 +1076,8 @@ def put_local_negative_offset_max_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1095,6 +1121,8 @@ def get_local_negative_offset_uppercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1145,6 +1173,8 @@ def get_local_negative_offset_lowercase_max_date_time( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1202,6 +1232,8 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1243,6 +1275,8 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1300,6 +1334,8 @@ def put_local_positive_offset_min_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1341,6 +1377,8 @@ def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1398,6 +1436,8 @@ def put_local_negative_offset_min_date_time( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1439,6 +1479,8 @@ def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.dat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1487,6 +1529,8 @@ def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py index 710edf0f390..ec1e41a56bb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py @@ -94,6 +94,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -142,6 +144,8 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -190,6 +194,8 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -238,6 +244,8 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -295,6 +303,8 @@ async def put_max_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -336,6 +346,8 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -393,6 +405,8 @@ async def put_min_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -434,6 +448,8 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py index bbdcaaee3ac..7f429566cb9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py @@ -206,6 +206,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -254,6 +256,8 @@ def get_invalid_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -302,6 +306,8 @@ def get_overflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -350,6 +356,8 @@ def get_underflow_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -407,6 +415,8 @@ def put_max_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -448,6 +458,8 @@ def get_max_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -505,6 +517,8 @@ def put_min_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -546,6 +560,8 @@ def get_min_date(self, **kwargs: Any) -> datetime.date: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py index 07f0673d90c..ce9d966fb01 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py @@ -161,6 +161,8 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -217,6 +219,8 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -321,6 +325,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -370,6 +376,8 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -426,6 +434,8 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -482,6 +492,8 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -538,6 +550,8 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -594,6 +608,8 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -698,6 +714,8 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -747,6 +765,8 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -803,6 +823,8 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -859,6 +881,8 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -963,6 +987,8 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1012,6 +1038,8 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1068,6 +1096,8 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1124,6 +1154,8 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1228,6 +1260,8 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1277,6 +1311,8 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1333,6 +1369,8 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1389,6 +1427,8 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1493,6 +1533,8 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1542,6 +1584,8 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1598,6 +1642,8 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1654,6 +1700,8 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1758,6 +1806,8 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1807,6 +1857,8 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1863,6 +1915,8 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1919,6 +1973,8 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2023,6 +2079,8 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2072,6 +2130,8 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2128,6 +2188,8 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2184,6 +2246,8 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2288,6 +2352,8 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2337,6 +2403,8 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2393,6 +2461,8 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2450,6 +2520,8 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2557,6 +2629,8 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2606,6 +2680,8 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2662,6 +2738,8 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2719,6 +2797,8 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2826,6 +2906,8 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2875,6 +2957,8 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2979,6 +3063,8 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3029,6 +3115,8 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3136,6 +3224,8 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3186,6 +3276,8 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3243,6 +3335,8 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3302,6 +3396,8 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSON]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3361,6 +3457,8 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3421,6 +3519,8 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3481,6 +3581,8 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3541,6 +3643,8 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3651,6 +3755,8 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3702,6 +3808,8 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3760,6 +3868,8 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3818,6 +3928,8 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3876,6 +3988,8 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3935,6 +4049,8 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4044,6 +4160,8 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4095,6 +4213,8 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4153,6 +4273,8 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4212,6 +4334,8 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4271,6 +4395,8 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4331,6 +4457,8 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4443,6 +4571,8 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py index d94902e7f58..9df440d137a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py @@ -1053,6 +1053,8 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1109,6 +1111,8 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1213,6 +1217,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1262,6 +1268,8 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1318,6 +1326,8 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1374,6 +1384,8 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1430,6 +1442,8 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1486,6 +1500,8 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1590,6 +1606,8 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1639,6 +1657,8 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1695,6 +1715,8 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1751,6 +1773,8 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1855,6 +1879,8 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1904,6 +1930,8 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1960,6 +1988,8 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2016,6 +2046,8 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2120,6 +2152,8 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2169,6 +2203,8 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2225,6 +2261,8 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2281,6 +2319,8 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2385,6 +2425,8 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2434,6 +2476,8 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2490,6 +2534,8 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2546,6 +2592,8 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2650,6 +2698,8 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2699,6 +2749,8 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2755,6 +2807,8 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2811,6 +2865,8 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2915,6 +2971,8 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2964,6 +3022,8 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3020,6 +3080,8 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3076,6 +3138,8 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3180,6 +3244,8 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3229,6 +3295,8 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3285,6 +3353,8 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3342,6 +3412,8 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3449,6 +3521,8 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3498,6 +3572,8 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3554,6 +3630,8 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3611,6 +3689,8 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3718,6 +3798,8 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3767,6 +3849,8 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3871,6 +3955,8 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3921,6 +4007,8 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4028,6 +4116,8 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4078,6 +4168,8 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4135,6 +4227,8 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4194,6 +4288,8 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSON]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4253,6 +4349,8 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4313,6 +4411,8 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4373,6 +4473,8 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4433,6 +4535,8 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4543,6 +4647,8 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4594,6 +4700,8 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4652,6 +4760,8 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4710,6 +4820,8 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4768,6 +4880,8 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4827,6 +4941,8 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4936,6 +5052,8 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4987,6 +5105,8 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5045,6 +5165,8 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5104,6 +5226,8 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5163,6 +5287,8 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5223,6 +5349,8 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5335,6 +5463,8 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index ad1d6ad9b1d..d83541e2e02 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -90,6 +90,8 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -147,6 +149,8 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -188,6 +192,8 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -236,6 +242,8 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index e3acfd5eb88..50e1d1adc5d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -149,6 +149,8 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -206,6 +208,8 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -247,6 +251,8 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -295,6 +301,8 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py index 8ab360c8012..dcd16a8650c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py @@ -87,7 +87,8 @@ async def get_file(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -133,7 +134,8 @@ async def get_file_large(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -179,7 +181,8 @@ async def get_empty_file(self, **kwargs: Any) -> AsyncIterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py index eabb7df61fb..562f3db9f79 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py @@ -129,7 +129,8 @@ def get_file(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,7 +176,8 @@ def get_file_large(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -221,7 +223,8 @@ def get_empty_file(self, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py index 6307ad7dd02..ff249a03d38 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py @@ -100,7 +100,8 @@ async def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py index ccfbac4a19c..b6e0e95bc2d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py @@ -122,7 +122,8 @@ def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> Iterat response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py index d81b83ca423..3f24e1aac01 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py @@ -100,6 +100,8 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -148,6 +150,8 @@ async def get_invalid(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -196,6 +200,8 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +250,8 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -292,6 +300,8 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -340,6 +350,8 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -395,6 +407,8 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -443,6 +457,8 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -491,6 +507,8 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -539,6 +557,8 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -580,6 +600,8 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -637,6 +659,8 @@ async def put_unix_time_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -678,6 +702,8 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -726,6 +752,8 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py index 143b7e2105a..14d2bbab314 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py @@ -301,6 +301,8 @@ def get_null(self, **kwargs: Any) -> Optional[int]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -349,6 +351,8 @@ def get_invalid(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -397,6 +401,8 @@ def get_overflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -445,6 +451,8 @@ def get_underflow_int32(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -493,6 +501,8 @@ def get_overflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -541,6 +551,8 @@ def get_underflow_int64(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -596,6 +608,8 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -644,6 +658,8 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -692,6 +708,8 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -740,6 +758,8 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -781,6 +801,8 @@ def get_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -838,6 +860,8 @@ def put_unix_time_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -879,6 +903,8 @@ def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -927,6 +953,8 @@ def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py index f787ad2d29f..53978940eb3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py @@ -109,6 +109,8 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -157,6 +159,8 @@ async def get_invalid_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -205,6 +209,8 @@ async def get_invalid_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -253,6 +259,8 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -310,6 +318,8 @@ async def put_big_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -351,6 +361,8 @@ async def get_big_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -408,6 +420,8 @@ async def put_big_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -449,6 +463,8 @@ async def get_big_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -505,6 +521,8 @@ async def put_big_double_positive_decimal( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -546,6 +564,8 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -602,6 +622,8 @@ async def put_big_double_negative_decimal( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -643,6 +665,8 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -700,6 +724,8 @@ async def put_big_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -741,6 +767,8 @@ async def get_big_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -797,6 +825,8 @@ async def put_big_decimal_positive_decimal( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -838,6 +868,8 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -894,6 +926,8 @@ async def put_big_decimal_negative_decimal( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -935,6 +969,8 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -992,6 +1028,8 @@ async def put_small_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1033,6 +1071,8 @@ async def get_small_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1090,6 +1130,8 @@ async def put_small_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1131,6 +1173,8 @@ async def get_small_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1188,6 +1232,8 @@ async def put_small_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1229,6 +1275,8 @@ async def get_small_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py index 83088389d38..1ff8367fc79 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py @@ -465,6 +465,8 @@ def get_null(self, **kwargs: Any) -> Optional[float]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -513,6 +515,8 @@ def get_invalid_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -561,6 +565,8 @@ def get_invalid_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -609,6 +615,8 @@ def get_invalid_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -666,6 +674,8 @@ def put_big_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -707,6 +717,8 @@ def get_big_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -764,6 +776,8 @@ def put_big_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -805,6 +819,8 @@ def get_big_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -859,6 +875,8 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -900,6 +918,8 @@ def get_big_double_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -954,6 +974,8 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -995,6 +1017,8 @@ def get_big_double_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1052,6 +1076,8 @@ def put_big_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1093,6 +1119,8 @@ def get_big_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1147,6 +1175,8 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1188,6 +1218,8 @@ def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1242,6 +1274,8 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1283,6 +1317,8 @@ def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1340,6 +1376,8 @@ def put_small_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1381,6 +1419,8 @@ def get_small_float(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1438,6 +1478,8 @@ def put_small_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1479,6 +1521,8 @@ def get_small_double(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1536,6 +1580,8 @@ def put_small_decimal( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1577,6 +1623,8 @@ def get_small_decimal(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 afd595a6883..93312045943 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 @@ -106,6 +106,8 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -166,6 +168,8 @@ async def put_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -207,6 +211,8 @@ async def get_empty(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -261,6 +267,8 @@ async def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -302,6 +310,8 @@ async def get_mbcs(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -361,6 +371,8 @@ async def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -404,6 +416,8 @@ async def get_whitespace(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -462,6 +476,8 @@ async def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -503,6 +519,8 @@ async def get_not_provided(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -551,6 +569,8 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -599,6 +619,8 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -656,6 +678,8 @@ async def put_base64_url_encoded( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -697,6 +721,8 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -763,6 +789,8 @@ async def get_not_expandable(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -821,6 +849,8 @@ async def put_not_expandable( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -862,6 +892,8 @@ async def get_referenced(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -920,6 +952,8 @@ async def put_referenced( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -970,6 +1004,8 @@ async def get_referenced_constant(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1084,6 +1120,8 @@ async def put_referenced_constant( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 e622c40a18f..ea2c107e2e2 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 @@ -391,6 +391,8 @@ def get_null(self, **kwargs: Any) -> Optional[str]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -451,6 +453,8 @@ def put_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -492,6 +496,8 @@ def get_empty(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -546,6 +552,8 @@ def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -587,6 +595,8 @@ def get_mbcs(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -646,6 +656,8 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -689,6 +701,8 @@ def get_whitespace(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -747,6 +761,8 @@ def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -788,6 +804,8 @@ def get_not_provided(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -836,6 +854,8 @@ def get_base64_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -884,6 +904,8 @@ def get_base64_url_encoded(self, **kwargs: Any) -> bytes: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -941,6 +963,8 @@ def put_base64_url_encoded( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -982,6 +1006,8 @@ def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1048,6 +1074,8 @@ def get_not_expandable(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1106,6 +1134,8 @@ def put_not_expandable( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1147,6 +1177,8 @@ def get_referenced(self, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1205,6 +1237,8 @@ def put_referenced( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1255,6 +1289,8 @@ def get_referenced_constant(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1369,6 +1405,8 @@ def put_referenced_constant( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py index 4dbe559e5b9..5e4b3a41aca 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py @@ -85,6 +85,8 @@ async def get(self, **kwargs: Any) -> datetime.time: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py index a6a89540732..5f19c1354af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py @@ -119,6 +119,8 @@ def get(self, **kwargs: Any) -> datetime.time: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -174,6 +176,8 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py index 53a2cbf9a32..e02e3d9390d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py @@ -87,6 +87,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py index 3abcf7979a4..0ebba5c8788 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py @@ -70,6 +70,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py index 22a85529596..d9beb77e64a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py @@ -109,6 +109,8 @@ async def put_no_model_as_string_no_required_two_value_no_default( # pylint: di response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -157,6 +159,8 @@ async def put_no_model_as_string_no_required_two_value_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -205,6 +209,8 @@ async def put_no_model_as_string_no_required_one_value_no_default( # pylint: di response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -253,6 +259,8 @@ async def put_no_model_as_string_no_required_one_value_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -301,6 +309,8 @@ async def put_no_model_as_string_required_two_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -349,6 +359,8 @@ async def put_no_model_as_string_required_two_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -396,6 +408,8 @@ async def put_no_model_as_string_required_one_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -443,6 +457,8 @@ async def put_no_model_as_string_required_one_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -491,6 +507,8 @@ async def put_model_as_string_no_required_two_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -539,6 +557,8 @@ async def put_model_as_string_no_required_two_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -587,6 +607,8 @@ async def put_model_as_string_no_required_one_value_no_default( # pylint: disab response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -635,6 +657,8 @@ async def put_model_as_string_no_required_one_value_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -683,6 +707,8 @@ async def put_model_as_string_required_two_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -731,6 +757,8 @@ async def put_model_as_string_required_two_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -779,6 +807,8 @@ async def put_model_as_string_required_one_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -827,6 +857,8 @@ async def put_model_as_string_required_one_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -872,6 +904,8 @@ async def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py index 431f4a01a53..2ec961779d2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py @@ -352,6 +352,8 @@ def put_no_model_as_string_no_required_two_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -400,6 +402,8 @@ def put_no_model_as_string_no_required_two_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -448,6 +452,8 @@ def put_no_model_as_string_no_required_one_value_no_default( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -496,6 +502,8 @@ def put_no_model_as_string_no_required_one_value_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -544,6 +552,8 @@ def put_no_model_as_string_required_two_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -592,6 +602,8 @@ def put_no_model_as_string_required_two_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -639,6 +651,8 @@ def put_no_model_as_string_required_one_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -686,6 +700,8 @@ def put_no_model_as_string_required_one_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -734,6 +750,8 @@ def put_model_as_string_no_required_two_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -782,6 +800,8 @@ def put_model_as_string_no_required_two_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -830,6 +850,8 @@ def put_model_as_string_no_required_one_value_no_default( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -878,6 +900,8 @@ def put_model_as_string_no_required_one_value_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -926,6 +950,8 @@ def put_model_as_string_required_two_value_no_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -974,6 +1000,8 @@ def put_model_as_string_required_two_value_default( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1022,6 +1050,8 @@ def put_model_as_string_required_one_value_no_default( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1070,6 +1100,8 @@ def put_model_as_string_required_one_value_default( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1115,6 +1147,8 @@ def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py index 0666a995c74..e57268f72e4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py @@ -103,6 +103,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py index 0a2d355c244..9b8c6df6311 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py @@ -134,6 +134,8 @@ def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index fb35ccb2635..37d9c210da9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -91,6 +91,8 @@ async def get_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 4ea7cce97af..c70f52c14d4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -107,6 +107,8 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py index f7665587262..46b99d3b197 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py @@ -113,6 +113,8 @@ def create_secret(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -161,6 +163,8 @@ def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py index fc8b2bb7227..05e13a386d1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py @@ -82,6 +82,8 @@ async def create_secret(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -130,6 +132,8 @@ async def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 d6fb64f1ede..cf452bfcfb4 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 @@ -99,6 +99,8 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -240,6 +242,8 @@ async def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kw response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 135cfbea952..503b9651234 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 @@ -138,6 +138,8 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -279,6 +281,8 @@ def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py index a40f4a23473..ec195449b3c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py @@ -120,6 +120,8 @@ async def param_existing_key( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -161,6 +163,8 @@ async def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -207,6 +211,8 @@ async def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -248,6 +254,8 @@ async def response_protected_key(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -302,6 +310,8 @@ async def param_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -349,6 +359,8 @@ async def response_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -403,6 +415,8 @@ async def param_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -450,6 +464,8 @@ async def response_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -504,6 +520,8 @@ async def param_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -551,6 +569,8 @@ async def response_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -605,6 +625,8 @@ async def param_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -652,6 +674,8 @@ async def response_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -706,6 +730,8 @@ async def param_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -753,6 +779,8 @@ async def response_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -808,6 +836,8 @@ async def param_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -855,6 +885,8 @@ async def response_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -909,6 +941,8 @@ async def param_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -956,6 +990,8 @@ async def response_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1011,6 +1047,8 @@ async def param_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1058,6 +1096,8 @@ async def response_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1113,6 +1153,8 @@ async def param_datetime_rfc1123( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1161,6 +1203,8 @@ async def response_datetime_rfc1123( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1213,6 +1257,8 @@ async def param_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1259,6 +1305,8 @@ async def response_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1311,6 +1359,8 @@ async def param_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1357,6 +1407,8 @@ async def response_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1412,6 +1464,8 @@ async def param_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1459,6 +1513,8 @@ async def response_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1504,6 +1560,8 @@ async def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py index 117445ab153..597cf0f415b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py @@ -546,6 +546,8 @@ def param_existing_key( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -587,6 +589,8 @@ def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -633,6 +637,8 @@ def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -674,6 +680,8 @@ def response_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -728,6 +736,8 @@ def param_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -775,6 +785,8 @@ def response_integer( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -829,6 +841,8 @@ def param_long( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -874,6 +888,8 @@ def response_long(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -928,6 +944,8 @@ def param_float( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -973,6 +991,8 @@ def response_float(self, *, scenario: str, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1027,6 +1047,8 @@ def param_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1074,6 +1096,8 @@ def response_double( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1128,6 +1152,8 @@ def param_bool( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1173,6 +1199,8 @@ def response_bool(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1228,6 +1256,8 @@ def param_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1275,6 +1305,8 @@ def response_string( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1329,6 +1361,8 @@ def param_date( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1374,6 +1408,8 @@ def response_date(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1429,6 +1465,8 @@ def param_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1476,6 +1514,8 @@ def response_datetime( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1531,6 +1571,8 @@ def param_datetime_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1579,6 +1621,8 @@ def response_datetime_rfc1123( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1631,6 +1675,8 @@ def param_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1677,6 +1723,8 @@ def response_duration( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1729,6 +1777,8 @@ def param_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1773,6 +1823,8 @@ def response_byte(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1828,6 +1880,8 @@ def param_enum( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1873,6 +1927,8 @@ def response_enum(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1918,6 +1974,8 @@ def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 2de0fee2dee..79ae0c13919 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 @@ -197,6 +197,8 @@ async def get_empty_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -245,6 +247,8 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -293,6 +297,8 @@ async def get_no_model_empty(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -359,6 +365,8 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -400,6 +408,8 @@ async def get200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -448,6 +458,8 @@ async def options200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -509,6 +521,8 @@ async def put200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -563,6 +577,8 @@ async def patch200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -617,6 +633,8 @@ async def post200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -671,6 +689,8 @@ async def delete200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -725,6 +745,8 @@ async def put201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -779,6 +801,8 @@ async def post201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -833,6 +857,8 @@ async def put202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -887,6 +913,8 @@ async def patch202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -941,6 +969,8 @@ async def post202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -995,6 +1025,8 @@ async def delete202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1036,6 +1068,8 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1090,6 +1124,8 @@ async def put204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1144,6 +1180,8 @@ async def patch204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1198,6 +1236,8 @@ async def post204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1252,6 +1292,8 @@ async def delete204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1293,6 +1335,8 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1352,6 +1396,8 @@ async def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1405,6 +1451,8 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1458,6 +1506,8 @@ async def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1503,6 +1553,8 @@ async def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1562,6 +1614,8 @@ async def put301( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [301]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1606,6 +1660,8 @@ async def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1651,6 +1707,8 @@ async def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1710,6 +1768,8 @@ async def patch302( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [302]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1768,6 +1828,8 @@ async def post303( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 303]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1813,6 +1875,8 @@ async def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1858,6 +1922,8 @@ async def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1903,6 +1969,8 @@ async def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1961,6 +2029,8 @@ async def put307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2019,6 +2089,8 @@ async def patch307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2077,6 +2149,8 @@ async def post307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2135,6 +2209,8 @@ async def delete307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2198,6 +2274,8 @@ async def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2239,6 +2317,8 @@ async def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2280,6 +2360,8 @@ async def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2334,6 +2416,8 @@ async def put400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2388,6 +2472,8 @@ async def patch400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2442,6 +2528,8 @@ async def post400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2496,6 +2584,8 @@ async def delete400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2537,6 +2627,8 @@ async def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2578,6 +2670,8 @@ async def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2619,6 +2713,8 @@ async def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2660,6 +2756,8 @@ async def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2714,6 +2812,8 @@ async def put404( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2768,6 +2868,8 @@ async def patch405( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2822,6 +2924,8 @@ async def post406( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2876,6 +2980,8 @@ async def delete407( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2930,6 +3036,8 @@ async def put409( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2971,6 +3079,8 @@ async def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3012,6 +3122,8 @@ async def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3053,6 +3165,8 @@ async def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3094,6 +3208,8 @@ async def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3148,6 +3264,8 @@ async def put413( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3202,6 +3320,8 @@ async def patch414( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3256,6 +3376,8 @@ async def post415( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3297,6 +3419,8 @@ async def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3351,6 +3475,8 @@ async def delete417( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3392,6 +3518,8 @@ async def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3451,6 +3579,8 @@ async def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3492,6 +3622,8 @@ async def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3546,6 +3678,8 @@ async def post505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3600,6 +3734,8 @@ async def delete505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3659,6 +3795,8 @@ async def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3713,6 +3851,8 @@ async def put500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3767,6 +3907,8 @@ async def patch500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3808,6 +3950,8 @@ async def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3849,6 +3993,8 @@ async def options502(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3910,6 +4056,8 @@ async def post503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3964,6 +4112,8 @@ async def delete503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4018,6 +4168,8 @@ async def put504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4072,6 +4224,8 @@ async def patch504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4141,6 +4295,8 @@ async def get200_model204_no_model_default_error200_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4201,6 +4357,8 @@ async def get200_model204_no_model_default_error204_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4261,6 +4419,8 @@ async def get200_model204_no_model_default_error201_invalid( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4321,6 +4481,8 @@ async def get200_model204_no_model_default_error202_none( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4381,6 +4543,8 @@ async def get200_model204_no_model_default_error400_valid( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4446,6 +4610,8 @@ async def get200_model201_model_default_error200_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4516,6 +4682,8 @@ async def get200_model201_model_default_error201_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4586,6 +4754,8 @@ async def get200_model201_model_default_error400_valid( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4659,6 +4829,8 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4738,6 +4910,8 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4817,6 +4991,8 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4896,6 +5072,8 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4959,6 +5137,8 @@ async def get202_none204_none_default_error202_none( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5002,6 +5182,8 @@ async def get202_none204_none_default_error204_none( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5045,6 +5227,8 @@ async def get202_none204_none_default_error400_valid( # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5088,6 +5272,8 @@ async def get202_none204_none_default_none202_invalid( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5131,6 +5317,8 @@ async def get202_none204_none_default_none204_none( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5174,6 +5362,8 @@ async def get202_none204_none_default_none400_none( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5217,6 +5407,8 @@ async def get202_none204_none_default_none400_invalid( # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5266,6 +5458,8 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5322,6 +5516,8 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5372,6 +5568,8 @@ async def get_default_model_a400_valid( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5415,6 +5613,8 @@ async def get_default_model_a400_none( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5458,6 +5658,8 @@ async def get_default_none200_invalid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5499,6 +5701,8 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5542,6 +5746,8 @@ async def get_default_none400_invalid( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5583,6 +5789,8 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5633,6 +5841,8 @@ async def get200_model_a200_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5689,6 +5899,8 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5745,6 +5957,8 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5801,6 +6015,8 @@ async def get200_model_a400_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5857,6 +6073,8 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5913,6 +6131,8 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5969,6 +6189,8 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 74004c6d823..586649b765b 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 @@ -1802,6 +1802,8 @@ def get_empty_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1850,6 +1852,8 @@ def get_no_model_error(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1898,6 +1902,8 @@ def get_no_model_empty(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1964,6 +1970,8 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2005,6 +2013,8 @@ def get200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2053,6 +2063,8 @@ def options200(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2114,6 +2126,8 @@ def put200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2168,6 +2182,8 @@ def patch200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2222,6 +2238,8 @@ def post200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2276,6 +2294,8 @@ def delete200( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2330,6 +2350,8 @@ def put201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2384,6 +2406,8 @@ def post201( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2438,6 +2462,8 @@ def put202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2492,6 +2518,8 @@ def patch202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2546,6 +2574,8 @@ def post202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2600,6 +2630,8 @@ def delete202( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2641,6 +2673,8 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2695,6 +2729,8 @@ def put204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2749,6 +2785,8 @@ def patch204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2803,6 +2841,8 @@ def post204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2857,6 +2897,8 @@ def delete204( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2898,6 +2940,8 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2957,6 +3001,8 @@ def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3010,6 +3056,8 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: response = pipeline_response.http_response if response.status_code not in [200, 300]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3063,6 +3111,8 @@ def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3108,6 +3158,8 @@ def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3167,6 +3219,8 @@ def put301( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [301]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3211,6 +3265,8 @@ def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3256,6 +3312,8 @@ def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3315,6 +3373,8 @@ def patch302( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [302]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3373,6 +3433,8 @@ def post303( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 303]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3418,6 +3480,8 @@ def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3463,6 +3527,8 @@ def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3508,6 +3574,8 @@ def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3566,6 +3634,8 @@ def put307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3624,6 +3694,8 @@ def patch307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3682,6 +3754,8 @@ def post307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3740,6 +3814,8 @@ def delete307( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 307]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3803,6 +3879,8 @@ def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3844,6 +3922,8 @@ def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3885,6 +3965,8 @@ def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3939,6 +4021,8 @@ def put400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3993,6 +4077,8 @@ def patch400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4047,6 +4133,8 @@ def post400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4101,6 +4189,8 @@ def delete400( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4142,6 +4232,8 @@ def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4183,6 +4275,8 @@ def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4224,6 +4318,8 @@ def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4265,6 +4361,8 @@ def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4319,6 +4417,8 @@ def put404( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4373,6 +4473,8 @@ def patch405( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4427,6 +4529,8 @@ def post406( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4481,6 +4585,8 @@ def delete407( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4535,6 +4641,8 @@ def put409( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4576,6 +4684,8 @@ def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4617,6 +4727,8 @@ def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4658,6 +4770,8 @@ def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4699,6 +4813,8 @@ def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4753,6 +4869,8 @@ def put413( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4807,6 +4925,8 @@ def patch414( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4861,6 +4981,8 @@ def post415( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4902,6 +5024,8 @@ def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4956,6 +5080,8 @@ def delete417( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4997,6 +5123,8 @@ def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5056,6 +5184,8 @@ def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5097,6 +5227,8 @@ def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5151,6 +5283,8 @@ def post505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5205,6 +5339,8 @@ def delete505( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in []: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5264,6 +5400,8 @@ def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5318,6 +5456,8 @@ def put500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5372,6 +5512,8 @@ def patch500( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5413,6 +5555,8 @@ def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5454,6 +5598,8 @@ def options502(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5515,6 +5661,8 @@ def post503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5569,6 +5717,8 @@ def delete503( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5623,6 +5773,8 @@ def put504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5677,6 +5829,8 @@ def patch504( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5746,6 +5900,8 @@ def get200_model204_no_model_default_error200_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5806,6 +5962,8 @@ def get200_model204_no_model_default_error204_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5866,6 +6024,8 @@ def get200_model204_no_model_default_error201_invalid( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5926,6 +6086,8 @@ def get200_model204_no_model_default_error202_none( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5986,6 +6148,8 @@ def get200_model204_no_model_default_error400_valid( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6049,6 +6213,8 @@ def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6117,6 +6283,8 @@ def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6185,6 +6353,8 @@ def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6258,6 +6428,8 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6337,6 +6509,8 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6416,6 +6590,8 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6495,6 +6671,8 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6558,6 +6736,8 @@ def get202_none204_none_default_error202_none( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6601,6 +6781,8 @@ def get202_none204_none_default_error204_none( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6644,6 +6826,8 @@ def get202_none204_none_default_error400_valid( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6687,6 +6871,8 @@ def get202_none204_none_default_none202_invalid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6730,6 +6916,8 @@ def get202_none204_none_default_none204_none( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6773,6 +6961,8 @@ def get202_none204_none_default_none400_none( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6816,6 +7006,8 @@ def get202_none204_none_default_none400_invalid( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6865,6 +7057,8 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6921,6 +7115,8 @@ def get_default_model_a200_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6969,6 +7165,8 @@ def get_default_model_a400_valid(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7010,6 +7208,8 @@ def get_default_model_a400_none(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7051,6 +7251,8 @@ def get_default_none200_invalid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7092,6 +7294,8 @@ def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7133,6 +7337,8 @@ def get_default_none400_invalid(self, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7174,6 +7380,8 @@ def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7224,6 +7432,8 @@ def get200_model_a200_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7280,6 +7490,8 @@ def get200_model_a200_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7336,6 +7548,8 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7392,6 +7606,8 @@ def get200_model_a400_none(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7448,6 +7664,8 @@ def get200_model_a400_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7504,6 +7722,8 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7560,6 +7780,8 @@ def get200_model_a202_valid(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py index 689c3e895d5..56c5a8504f3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py @@ -82,6 +82,8 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py index 91e49ce0125..fde60f5d091 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py @@ -72,6 +72,8 @@ async def get_incorrect_error_from_server( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 991ff4b343a..2ec443f9983 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 @@ -262,6 +262,8 @@ def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -387,6 +389,8 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -438,6 +442,8 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -494,6 +500,8 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -551,6 +559,8 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -606,6 +616,8 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 e5328fd345b..a6a68a99b74 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 @@ -157,6 +157,8 @@ async def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -282,6 +284,8 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -333,6 +337,8 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -389,6 +395,8 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -446,6 +454,8 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -501,6 +511,8 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py index 3aaec2fee7f..3d921e90bd7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py @@ -100,6 +100,8 @@ def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py index e7d35c580e2..e9ded7a8a38 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py @@ -78,6 +78,8 @@ async def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 0f31b679407..03760f891c3 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 @@ -356,6 +356,8 @@ def put_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -422,6 +424,8 @@ def get_array(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -544,6 +548,8 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -601,6 +607,8 @@ def get_wrapped_array(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -736,6 +744,8 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -802,6 +812,8 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1029,6 +1041,8 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1129,6 +1143,8 @@ def get_resource_collection(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1315,6 +1331,8 @@ def put_simple_product(self, simple_body_product: Optional[Union[JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1503,6 +1521,8 @@ def post_flattened_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1708,6 +1728,8 @@ def put_simple_product_with_grouping( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 fd7cad3ee00..41fe0f86f12 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 @@ -163,6 +163,8 @@ async def put_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -229,6 +231,8 @@ async def get_array(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -351,6 +355,8 @@ async def put_wrapped_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -408,6 +414,8 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -543,6 +551,8 @@ async def put_dictionary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -609,6 +619,8 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSON]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -836,6 +848,8 @@ async def put_resource_collection( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -936,6 +950,8 @@ async def get_resource_collection(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1124,6 +1140,8 @@ async def put_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1312,6 +1330,8 @@ async def post_flattened_simple_product( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1517,6 +1537,8 @@ async def put_simple_product_with_grouping( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py index 53cc2e66eda..a1177c24b27 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py @@ -249,6 +249,8 @@ def get_horse(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -358,6 +360,8 @@ def put_horse(self, horse: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -414,6 +418,8 @@ def get_pet(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -520,6 +526,8 @@ def put_pet(self, pet: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -577,6 +585,8 @@ def get_feline(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -686,6 +696,8 @@ def put_feline(self, feline: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -745,6 +757,8 @@ def get_cat(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -860,6 +874,8 @@ def put_cat(self, cat: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -921,6 +937,8 @@ def get_kitten(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1041,6 +1059,8 @@ def put_kitten(self, kitten: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py index 78c6a1316ee..c2dd5a99560 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py @@ -94,6 +94,8 @@ async def get_horse(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +205,8 @@ async def put_horse(self, horse: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -259,6 +263,8 @@ async def get_pet(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -365,6 +371,8 @@ async def put_pet(self, pet: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -422,6 +430,8 @@ async def get_feline(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -531,6 +541,8 @@ async def put_feline(self, feline: Union[JSON, IO[bytes]], **kwargs: Any) -> str response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -590,6 +602,8 @@ async def get_cat(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -705,6 +719,8 @@ async def put_cat(self, cat: Union[JSON, IO[bytes]], **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -766,6 +782,8 @@ async def get_kitten(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -886,6 +904,8 @@ async def put_kitten(self, kitten: Union[JSON, IO[bytes]], **kwargs: Any) -> str response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py index bb5cd06b70c..e0f4956ec13 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py @@ -158,6 +158,8 @@ def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -214,6 +216,8 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -255,6 +259,8 @@ def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -311,6 +317,8 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -352,6 +360,8 @@ def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -408,6 +418,8 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py index ee5a72ad150..cc4f9a4349d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py @@ -78,6 +78,8 @@ async def get_object(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -134,6 +136,8 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,6 +179,8 @@ async def get_string(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -231,6 +237,8 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -272,6 +280,8 @@ async def get_array(self, **kwargs: Any) -> Any: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -328,6 +338,8 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 88685b679a1..00d9bccf7eb 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 @@ -100,6 +100,8 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -148,6 +150,8 @@ async def get(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +229,8 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -273,6 +279,8 @@ async def get(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 eb2167fc078..7d8fb816ab7 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 @@ -160,6 +160,8 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -208,6 +210,8 @@ def get(self, **kwargs: Any) -> int: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -285,6 +289,8 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -333,6 +339,8 @@ def get(self, **kwargs: Any) -> float: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py index dc68b2b855a..56ebfc8ff95 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py @@ -106,6 +106,8 @@ def get(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -163,6 +165,8 @@ def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py index 46c94b5d5f6..88acd1179b8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py @@ -72,6 +72,8 @@ async def get(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -129,6 +131,8 @@ async def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py index b37f9531b96..28034683e51 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py @@ -174,6 +174,8 @@ async def update( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py index 7d6e044e385..b1050840361 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py @@ -197,6 +197,8 @@ def update( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py index 38ba247647b..371befad41c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py @@ -82,6 +82,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py index 620f8e1b14e..1dddfb89a84 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py @@ -72,6 +72,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py index 7315c4b75ec..717a9e3536c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py @@ -128,6 +128,8 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -189,6 +191,8 @@ def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py index 375e893bdee..a4b113bd8a6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py @@ -85,6 +85,8 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -146,6 +148,8 @@ async def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 5ac57c6c791..84d903c4821 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 @@ -124,6 +124,8 @@ async def get_required_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -170,6 +172,8 @@ async def put_optional_query( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -216,6 +220,8 @@ async def put_optional_header( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -269,6 +275,8 @@ async def put_optional_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -319,6 +327,8 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -361,6 +371,8 @@ async def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -403,6 +415,8 @@ async def get_required_global_query(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -445,6 +459,8 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -513,6 +529,8 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -563,6 +581,8 @@ async def put_required_binary_body( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -614,6 +634,8 @@ async def post_required_integer_parameter( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -667,6 +689,8 @@ async def post_optional_integer_parameter( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -775,6 +799,8 @@ async def post_required_integer_property( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -883,6 +909,8 @@ async def post_optional_integer_property( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -930,6 +958,8 @@ async def post_required_integer_header( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -976,6 +1006,8 @@ async def post_optional_integer_header( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1027,6 +1059,8 @@ async def post_required_string_parameter( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1080,6 +1114,8 @@ async def post_optional_string_parameter( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1188,6 +1224,8 @@ async def post_required_string_property( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1296,6 +1334,8 @@ async def post_optional_string_property( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1343,6 +1383,8 @@ async def post_required_string_header( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1389,6 +1431,8 @@ async def post_optional_string_header( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1499,6 +1543,8 @@ async def post_required_class_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1609,6 +1655,8 @@ async def post_optional_class_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1723,6 +1771,8 @@ async def post_required_class_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1837,6 +1887,8 @@ async def post_optional_class_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1937,6 +1989,8 @@ async def post_required_array_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2037,6 +2091,8 @@ async def post_optional_array_parameter( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2149,6 +2205,8 @@ async def post_required_array_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2261,6 +2319,8 @@ async def post_optional_array_property( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2308,6 +2368,8 @@ async def post_required_array_header( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2354,6 +2416,8 @@ async def post_optional_array_header( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 f3d0cc2d742..c4e7cd047bc 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 @@ -677,6 +677,8 @@ def get_required_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -723,6 +725,8 @@ def put_optional_query( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -769,6 +773,8 @@ def put_optional_header( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -822,6 +828,8 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -872,6 +880,8 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -914,6 +924,8 @@ def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -956,6 +968,8 @@ def get_required_global_query(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -998,6 +1012,8 @@ def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1066,6 +1082,8 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1116,6 +1134,8 @@ def put_required_binary_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1167,6 +1187,8 @@ def post_required_integer_parameter( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1220,6 +1242,8 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1328,6 +1352,8 @@ def post_required_integer_property( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1436,6 +1462,8 @@ def post_optional_integer_property( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1483,6 +1511,8 @@ def post_required_integer_header( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1529,6 +1559,8 @@ def post_optional_integer_header( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1580,6 +1612,8 @@ def post_required_string_parameter( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1633,6 +1667,8 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1741,6 +1777,8 @@ def post_required_string_property( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1849,6 +1887,8 @@ def post_optional_string_property( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1896,6 +1936,8 @@ def post_required_string_header( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1942,6 +1984,8 @@ def post_optional_string_header( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2052,6 +2096,8 @@ def post_required_class_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2162,6 +2208,8 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2276,6 +2324,8 @@ def post_required_class_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2390,6 +2440,8 @@ def post_optional_class_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2490,6 +2542,8 @@ def post_required_array_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2590,6 +2644,8 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2702,6 +2758,8 @@ def post_required_array_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2814,6 +2872,8 @@ def post_optional_array_property( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2861,6 +2921,8 @@ def post_required_array_header( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2907,6 +2969,8 @@ def post_optional_array_header( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py index c0e7fae9f0f..ba155160e63 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py @@ -95,6 +95,8 @@ async def operation_one(self, *, parameter1: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -162,6 +164,8 @@ async def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -217,6 +221,8 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -279,6 +285,8 @@ async def operation_with_url( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -331,6 +339,8 @@ async def reserved_enum(self, *, enum_parameter: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py index 73096e79b81..ca4dbef0f9f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py @@ -196,6 +196,8 @@ def operation_one(self, *, parameter1: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -263,6 +265,8 @@ def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) -> JSO response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -318,6 +322,8 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -380,6 +386,8 @@ def operation_with_url( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -432,6 +440,8 @@ def reserved_enum(self, *, enum_parameter: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py index d586be31c7d..c9d08d02cc8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py @@ -79,6 +79,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py index c46f7c06b6a..2d977e3dc43 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py index c519104c668..eabe3ce9136 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py @@ -79,6 +79,8 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py index c1c5ec5ae13..ad6dfcb8ea0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py index cf7a59c1fb3..63db587f63f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py @@ -93,6 +93,8 @@ async def array_string_multi_null( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ async def array_string_multi_empty( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -188,6 +192,8 @@ async def array_string_multi_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py index eb2bf652a46..cffc288b9c6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py @@ -162,6 +162,8 @@ def array_string_multi_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -209,6 +211,8 @@ def array_string_multi_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -257,6 +261,8 @@ def array_string_multi_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py index f92422fd470..1a2052ea372 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py @@ -154,6 +154,8 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -197,6 +199,8 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -240,6 +244,8 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -285,6 +291,8 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -328,6 +336,8 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -371,6 +381,8 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -414,6 +426,8 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -457,6 +471,8 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -500,6 +516,8 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -543,6 +561,8 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -586,6 +606,8 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -629,6 +651,8 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -674,6 +698,8 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -717,6 +743,8 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -763,6 +791,8 @@ async def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -808,6 +838,8 @@ async def enum_valid(self, enum_path: str, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -853,6 +885,8 @@ async def enum_null(self, enum_path: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -899,6 +933,8 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -942,6 +978,8 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -988,6 +1026,8 @@ async def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1031,6 +1071,8 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1078,6 +1120,8 @@ async def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1121,6 +1165,8 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1167,6 +1213,8 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1213,6 +1261,8 @@ async def base64_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1261,6 +1311,8 @@ async def array_csv_in_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1307,6 +1359,8 @@ async def unix_time_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1368,6 +1422,8 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1411,6 +1467,8 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1457,6 +1515,8 @@ async def get_boolean_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1500,6 +1560,8 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1545,6 +1607,8 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1591,6 +1655,8 @@ async def get_int_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1634,6 +1700,8 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1677,6 +1745,8 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1723,6 +1793,8 @@ async def get_long_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1766,6 +1838,8 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1809,6 +1883,8 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1855,6 +1931,8 @@ async def float_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1898,6 +1976,8 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1941,6 +2021,8 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1987,6 +2069,8 @@ async def double_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2032,6 +2116,8 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2077,6 +2163,8 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2120,6 +2208,8 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2166,6 +2256,8 @@ async def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2213,6 +2305,8 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2260,6 +2354,8 @@ async def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2307,6 +2403,8 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2350,6 +2448,8 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2396,6 +2496,8 @@ async def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2439,6 +2541,8 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2485,6 +2589,8 @@ async def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2530,6 +2636,8 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2576,6 +2684,8 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2624,6 +2734,8 @@ async def array_string_csv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2670,6 +2782,8 @@ async def array_string_csv_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2717,6 +2831,8 @@ async def array_string_csv_empty( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2765,6 +2881,8 @@ async def array_string_no_collection_format_empty( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2813,6 +2931,8 @@ async def array_string_ssv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2861,6 +2981,8 @@ async def array_string_tsv_valid( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2909,6 +3031,8 @@ async def array_string_pipes_valid( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2994,6 +3118,8 @@ async def get_all_with_values( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3061,6 +3187,8 @@ async def get_global_query_null( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3128,6 +3256,8 @@ async def get_global_and_local_query_null( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3194,6 +3324,8 @@ async def get_local_path_item_query_null( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py index ace2e93f350..48cf027253a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py @@ -1465,6 +1465,8 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1508,6 +1510,8 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1551,6 +1555,8 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1594,6 +1600,8 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1637,6 +1645,8 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1680,6 +1690,8 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1723,6 +1735,8 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1766,6 +1780,8 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1809,6 +1825,8 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1852,6 +1870,8 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1895,6 +1915,8 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1938,6 +1960,8 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1983,6 +2007,8 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2026,6 +2052,8 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2070,6 +2098,8 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2115,6 +2145,8 @@ def enum_valid(self, enum_path: str, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2160,6 +2192,8 @@ def enum_null(self, enum_path: str, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2206,6 +2240,8 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2249,6 +2285,8 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2293,6 +2331,8 @@ def byte_null(self, byte_path: bytes, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2336,6 +2376,8 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2383,6 +2425,8 @@ def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2426,6 +2470,8 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2472,6 +2518,8 @@ def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [400]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2518,6 +2566,8 @@ def base64_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2566,6 +2616,8 @@ def array_csv_in_path( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2612,6 +2664,8 @@ def unix_time_url( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2673,6 +2727,8 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2716,6 +2772,8 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2762,6 +2820,8 @@ def get_boolean_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2805,6 +2865,8 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2848,6 +2910,8 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2894,6 +2958,8 @@ def get_int_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2937,6 +3003,8 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2980,6 +3048,8 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3026,6 +3096,8 @@ def get_long_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3069,6 +3141,8 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3112,6 +3186,8 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3158,6 +3234,8 @@ def float_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3201,6 +3279,8 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3244,6 +3324,8 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3290,6 +3372,8 @@ def double_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3335,6 +3419,8 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3380,6 +3466,8 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3423,6 +3511,8 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3469,6 +3559,8 @@ def string_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3516,6 +3608,8 @@ def enum_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3563,6 +3657,8 @@ def enum_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3610,6 +3706,8 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3653,6 +3751,8 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3699,6 +3799,8 @@ def byte_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3742,6 +3844,8 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3788,6 +3892,8 @@ def date_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3833,6 +3939,8 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3879,6 +3987,8 @@ def date_time_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3927,6 +4037,8 @@ def array_string_csv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3973,6 +4085,8 @@ def array_string_csv_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4020,6 +4134,8 @@ def array_string_csv_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4068,6 +4184,8 @@ def array_string_no_collection_format_empty( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4116,6 +4234,8 @@ def array_string_ssv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4164,6 +4284,8 @@ def array_string_tsv_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4212,6 +4334,8 @@ def array_string_pipes_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4297,6 +4421,8 @@ def get_all_with_values( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4364,6 +4490,8 @@ def get_global_query_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4431,6 +4559,8 @@ def get_global_and_local_query_null( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4497,6 +4627,8 @@ def get_local_path_item_query_null( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 d5da7075495..d54fa3e88ba 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 @@ -210,6 +210,8 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -449,6 +451,8 @@ def validation_of_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -499,6 +503,8 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -700,6 +706,8 @@ def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]]] = No response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) 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 cb5ffd6972d..4557ebf5401 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 @@ -109,6 +109,8 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -348,6 +350,8 @@ async def validation_of_body( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -398,6 +402,8 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -599,6 +605,8 @@ async def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py index 967e8416972..0954fbb12c4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py @@ -123,6 +123,8 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithR response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -177,6 +179,8 @@ async def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -218,6 +222,8 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWit response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -272,6 +278,8 @@ async def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -313,6 +321,8 @@ async def get_simple(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -368,6 +378,8 @@ async def put_simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -410,6 +422,8 @@ async def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -464,6 +478,8 @@ async def put_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -506,6 +522,8 @@ async def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -550,6 +568,8 @@ async def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -604,6 +624,8 @@ async def put_empty_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -645,6 +667,8 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -699,6 +723,8 @@ async def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -740,6 +766,8 @@ async def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -795,6 +823,8 @@ async def put_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -836,6 +866,8 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -891,6 +923,8 @@ async def put_root_list_single_item( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -932,6 +966,8 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -987,6 +1023,8 @@ async def put_empty_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1028,6 +1066,8 @@ async def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1082,6 +1122,8 @@ async def put_empty_child_element( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1125,6 +1167,8 @@ async def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1174,6 +1218,8 @@ async def get_service_properties(self, **kwargs: Any) -> _models.StorageServiceP response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1232,6 +1278,8 @@ async def put_service_properties( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1277,6 +1325,8 @@ async def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1338,6 +1388,8 @@ async def put_acls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1383,6 +1435,8 @@ async def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1479,6 +1533,8 @@ async def json_input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1520,6 +1576,8 @@ async def json_output(self, **kwargs: Any) -> _models.JSONOutput: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1566,6 +1624,8 @@ async def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1611,6 +1671,8 @@ async def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1666,6 +1728,8 @@ async def put_binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1708,6 +1772,8 @@ async def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1763,6 +1829,8 @@ async def put_uri( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py index 19f59547844..d7c15674b55 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py @@ -622,6 +622,8 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithRefAndN response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -676,6 +678,8 @@ def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -717,6 +721,8 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWithRefAn response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -771,6 +777,8 @@ def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -812,6 +820,8 @@ def get_simple(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -867,6 +877,8 @@ def put_simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -909,6 +921,8 @@ def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -963,6 +977,8 @@ def put_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1005,6 +1021,8 @@ def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1049,6 +1067,8 @@ def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1103,6 +1123,8 @@ def put_empty_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1144,6 +1166,8 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1198,6 +1222,8 @@ def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1239,6 +1265,8 @@ def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1294,6 +1322,8 @@ def put_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1335,6 +1365,8 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1390,6 +1422,8 @@ def put_root_list_single_item( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1431,6 +1465,8 @@ def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1486,6 +1522,8 @@ def put_empty_root_list( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1527,6 +1565,8 @@ def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1581,6 +1621,8 @@ def put_empty_child_element( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1624,6 +1666,8 @@ def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1673,6 +1717,8 @@ def get_service_properties(self, **kwargs: Any) -> _models.StorageServicePropert response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1731,6 +1777,8 @@ def put_service_properties( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1776,6 +1824,8 @@ def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1837,6 +1887,8 @@ def put_acls( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1882,6 +1934,8 @@ def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1978,6 +2032,8 @@ def json_input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2019,6 +2075,8 @@ def json_output(self, **kwargs: Any) -> _models.JSONOutput: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2065,6 +2123,8 @@ def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2110,6 +2170,8 @@ def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2165,6 +2227,8 @@ def put_binary( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2207,6 +2271,8 @@ def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -2262,6 +2328,8 @@ def put_uri( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [201]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py index 52755a8741f..ea6f00ea086 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py @@ -102,6 +102,8 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]: response = pipeline_response.http_response if response.status_code not in [200, 202]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) @@ -164,6 +166,8 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -220,6 +224,8 @@ async def has_models_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py index bbbe00e30c6..5c74bb8ff79 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py @@ -159,6 +159,8 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]: response = pipeline_response.http_response if response.status_code not in [200, 202]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore raise HttpResponseError(response=response) @@ -221,6 +223,8 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -277,6 +281,8 @@ def has_models_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py index a34796fb475..c813deaa7ef 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py @@ -96,6 +96,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -143,6 +145,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py index 3af2aeb3d1b..e718bf8c87f 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py @@ -71,6 +71,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -118,6 +120,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py index ff0a95c5417..4ce61101cde 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py @@ -96,6 +96,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -143,6 +145,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py index 81640c2ca08..52db39bfff8 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py @@ -71,6 +71,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -118,6 +120,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py index b6c70432bdd..da76436dd84 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py @@ -96,6 +96,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -143,6 +145,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py index 150aecd8d29..a2a177acca5 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py @@ -71,6 +71,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -118,6 +120,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py index 5df73dd1bc1..202ed82caf8 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py @@ -86,6 +86,8 @@ def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -127,6 +129,8 @@ def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py index 031f42bf9de..77e5ea5e7e9 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -110,6 +112,8 @@ async def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/aio/operations/_operations.py index be80cf88635..b495315719b 100644 --- a/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/aio/operations/_operations.py @@ -222,7 +222,8 @@ async def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -599,7 +600,8 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -935,7 +937,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1107,6 +1110,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1208,6 +1213,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1375,7 +1382,8 @@ async def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1743,7 +1751,8 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2075,7 +2084,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2253,6 +2263,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/operations/_operations.py index 80d4f87bf71..c57fa5b4778 100644 --- a/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-arm-models-resources/azure/arm/models/resources/operations/_operations.py @@ -553,7 +553,8 @@ def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -930,7 +931,8 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1266,7 +1268,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1438,6 +1441,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1539,6 +1544,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1706,7 +1713,8 @@ def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2070,7 +2078,8 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2398,7 +2407,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2575,6 +2585,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py index 73033c541db..eeb5bc69c41 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py @@ -195,6 +195,8 @@ async def input_to_input_output( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py index 217493c1ffb..1a3b446fd02 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py @@ -245,6 +245,8 @@ def input_to_input_output( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py index 6219c7a264f..3b495335cd6 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py @@ -144,6 +144,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -225,6 +227,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -892,6 +896,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -981,6 +987,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1225,6 +1233,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1314,6 +1324,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1362,6 +1374,8 @@ async def delete(self, id: int, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py index 8b463221261..b0bec9dbaea 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py @@ -410,6 +410,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -491,6 +493,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1154,6 +1158,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1243,6 +1249,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1487,6 +1495,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1576,6 +1586,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1624,6 +1636,8 @@ def delete(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py index 489209d22bb..16e5571d951 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py @@ -163,7 +163,8 @@ def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -392,7 +393,8 @@ def _delete_initial(self, name: str, **kwargs: Any) -> Iterator[bytes]: response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -482,7 +484,8 @@ def _export_initial(self, name: str, *, format: str, **kwargs: Any) -> Iterator[ response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py index 8bc549d1095..8e687343139 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py @@ -88,7 +88,8 @@ async def _create_or_replace_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -321,7 +322,8 @@ async def _delete_initial(self, name: str, **kwargs: Any) -> AsyncIterator[bytes response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -411,7 +413,8 @@ async def _export_initial(self, name: str, *, format: str, **kwargs: Any) -> Asy response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py index be32b30852b..40a72d11232 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py @@ -152,6 +152,8 @@ async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -350,6 +352,8 @@ async def header(self, *, region: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -394,6 +398,8 @@ async def query(self, *, region: str, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py index ce58894755f..67c093cbf32 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py @@ -221,6 +221,8 @@ def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -417,6 +419,8 @@ def header(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=inco response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -461,6 +465,8 @@ def query(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py index f96932cacad..696dfb0ca45 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py @@ -202,6 +202,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -362,7 +364,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -997,7 +1000,8 @@ async def _delete_initial(self, resource_group_name: str, catalog_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1167,6 +1171,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1267,6 +1273,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1487,6 +1495,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1827,6 +1837,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1943,6 +1955,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2071,6 +2085,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2123,7 +2139,8 @@ async def _upload_image_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2568,6 +2585,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3058,7 +3077,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3449,7 +3469,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3650,6 +3671,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3814,7 +3837,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4182,7 +4206,8 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4509,7 +4534,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4686,6 +4712,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4874,6 +4902,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5048,7 +5078,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5461,7 +5492,8 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5830,7 +5862,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6038,6 +6071,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6098,7 +6133,8 @@ async def _claim_devices_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6585,7 +6621,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7138,7 +7175,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7382,6 +7420,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7567,7 +7607,8 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8319,7 +8360,8 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8519,6 +8561,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8581,7 +8625,8 @@ async def _generate_capability_image_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py index f04a4ad6ee6..30ccbf0f645 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py @@ -1704,6 +1704,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1864,7 +1866,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2499,7 +2502,8 @@ def _delete_initial(self, resource_group_name: str, catalog_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2669,6 +2673,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2769,6 +2775,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2987,6 +2995,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3327,6 +3337,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3443,6 +3455,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3571,6 +3585,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3623,7 +3639,8 @@ def _upload_image_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4068,6 +4085,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4558,7 +4577,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4949,7 +4969,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5150,6 +5171,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5312,7 +5335,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5680,7 +5704,8 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6007,7 +6032,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6184,6 +6210,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6372,6 +6400,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6546,7 +6576,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6959,7 +6990,8 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7328,7 +7360,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7536,6 +7569,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7596,7 +7631,8 @@ def _claim_devices_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8083,7 +8119,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8636,7 +8673,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8880,6 +8918,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -9065,7 +9105,8 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -9817,7 +9858,8 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10017,6 +10059,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10079,7 +10123,8 @@ def _generate_capability_image_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_operations.py index b14a4ce36d6..f9f0b174afe 100644 --- a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_operations.py @@ -84,6 +84,8 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_operations.py index 6392a775ecc..456ecbf6b20 100644 --- a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py index 6f2e4faabc2..8e55fef23e8 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py @@ -108,7 +108,8 @@ def _long_running_rpc_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py index 25dc9b5aaf3..7c2eb68fa94 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py @@ -83,7 +83,8 @@ async def _long_running_rpc_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py index 342c85b94c7..f0fd5d80f43 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py @@ -180,6 +180,8 @@ async def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -299,6 +301,8 @@ async def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -367,6 +371,8 @@ async def union_enum_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -417,6 +423,8 @@ async def union_enum_member_name( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -461,6 +469,8 @@ async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -507,6 +517,8 @@ async def parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -626,6 +638,8 @@ async def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -745,6 +759,8 @@ async def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -865,6 +881,8 @@ async def compatible_with_encoded_name( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -911,6 +929,8 @@ async def request( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -952,6 +972,8 @@ async def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py index f4c93fb680e..90725cb39f2 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py @@ -305,6 +305,8 @@ def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -424,6 +426,8 @@ def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -492,6 +496,8 @@ def union_enum_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -542,6 +548,8 @@ def union_enum_member_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -586,6 +594,8 @@ def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -630,6 +640,8 @@ def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -749,6 +761,8 @@ def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -868,6 +882,8 @@ def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -988,6 +1004,8 @@ def compatible_with_encoded_name( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1032,6 +1050,8 @@ def request(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1073,6 +1093,8 @@ def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py index b3c49c65c96..17fa3050959 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py @@ -120,6 +120,8 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -183,6 +185,8 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -228,6 +232,8 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -291,6 +297,8 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -336,6 +344,8 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -384,6 +394,8 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -429,6 +441,8 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -492,6 +506,8 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -555,6 +571,8 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py index d0a2b44bd12..7ac8f5920ff 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py @@ -176,6 +176,8 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -239,6 +241,8 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -284,6 +288,8 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -347,6 +353,8 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -392,6 +400,8 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -440,6 +450,8 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -485,6 +497,8 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -548,6 +562,8 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -611,6 +627,8 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py index fcf98bd94c5..3373207a754 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py @@ -118,6 +118,8 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -163,6 +165,8 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -208,6 +212,8 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -256,6 +262,8 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -301,6 +309,8 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -346,6 +356,8 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py index eb3c234477c..19d7cf66ceb 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py @@ -80,6 +80,8 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -125,6 +127,8 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -170,6 +174,8 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -218,6 +224,8 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -263,6 +271,8 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -308,6 +318,8 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py index c0c58625042..a7b9f5d2425 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py @@ -95,6 +95,8 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -185,6 +189,8 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -233,6 +239,8 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -278,6 +286,8 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -323,6 +333,8 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py index f11b75a0212..6b1f8a3c615 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py @@ -133,6 +133,8 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -178,6 +180,8 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -223,6 +227,8 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -271,6 +277,8 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -316,6 +324,8 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -361,6 +371,8 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py index e9015d9eaa9..a345091102a 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py @@ -94,6 +94,8 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -139,6 +141,8 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -184,6 +188,8 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -247,6 +253,8 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -292,6 +300,8 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -337,6 +347,8 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py index 0c840625f1e..697e3b5e58f 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py @@ -132,6 +132,8 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -177,6 +179,8 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -222,6 +226,8 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -285,6 +291,8 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -330,6 +338,8 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -375,6 +385,8 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py index 32aa40f56b6..bebd6231092 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py @@ -115,6 +115,8 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -159,6 +161,8 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +207,8 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -249,6 +255,8 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -962,6 +970,8 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1006,6 +1016,8 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1050,6 +1062,8 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1096,6 +1110,8 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1162,6 +1178,8 @@ async def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1210,6 +1228,8 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1260,6 +1280,8 @@ async def custom_content_type( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1308,6 +1330,8 @@ async def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1356,6 +1380,8 @@ async def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py index 3a856796cc1..9a6370b4933 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py @@ -394,6 +394,8 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -438,6 +440,8 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -482,6 +486,8 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -528,6 +534,8 @@ def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1241,6 +1249,8 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1285,6 +1295,8 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1329,6 +1341,8 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1375,6 +1389,8 @@ def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1441,6 +1457,8 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1489,6 +1507,8 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1539,6 +1559,8 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1587,6 +1609,8 @@ def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1635,6 +1659,8 @@ def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py index fe72a93b9aa..26cdb845b87 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py @@ -115,6 +115,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -161,6 +163,8 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -207,6 +211,8 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -253,6 +259,8 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -299,6 +307,8 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1173,6 +1183,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1219,6 +1231,8 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1265,6 +1279,8 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1311,6 +1327,8 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1357,6 +1375,8 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1416,6 +1436,8 @@ async def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1460,6 +1482,8 @@ async def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1504,6 +1528,8 @@ async def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1548,6 +1574,8 @@ async def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py index 2d851abf612..19c47de3264 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py @@ -333,6 +333,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -379,6 +381,8 @@ def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -425,6 +429,8 @@ def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -471,6 +477,8 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -517,6 +525,8 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1391,6 +1401,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1437,6 +1449,8 @@ def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1483,6 +1497,8 @@ def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1529,6 +1545,8 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1575,6 +1593,8 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1634,6 +1654,8 @@ def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1678,6 +1700,8 @@ def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1722,6 +1746,8 @@ def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1766,6 +1792,8 @@ def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py index 63bbeeca841..488c7e4a5ea 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py @@ -114,6 +114,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -160,6 +162,8 @@ async def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -206,6 +210,8 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -252,6 +258,8 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -298,6 +306,8 @@ async def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -344,6 +354,8 @@ async def int32_seconds_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1382,6 +1394,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1428,6 +1442,8 @@ async def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1474,6 +1490,8 @@ async def iso8601_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1520,6 +1538,8 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1566,6 +1586,8 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1612,6 +1634,8 @@ async def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py index 993cc1217eb..d5c4615b870 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py @@ -344,6 +344,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -390,6 +392,8 @@ def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -434,6 +438,8 @@ def int32_seconds(self, *, input: int, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -478,6 +484,8 @@ def float_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -522,6 +530,8 @@ def float64_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -568,6 +578,8 @@ def int32_seconds_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1606,6 +1618,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1652,6 +1666,8 @@ def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1698,6 +1714,8 @@ def iso8601_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1742,6 +1760,8 @@ def int32_seconds(self, *, duration: int, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1788,6 +1808,8 @@ def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1834,6 +1856,8 @@ def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py index 9de73a831f1..7c265d74623 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py @@ -461,6 +461,8 @@ def head_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -596,6 +598,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -731,6 +735,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -866,6 +872,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1001,6 +1009,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py index 7a36de23aba..7b6aafd6daa 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py @@ -378,6 +378,8 @@ async def head_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -513,6 +515,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -648,6 +652,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -783,6 +789,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -918,6 +926,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py index f9019933adb..2fab0aef0aa 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py @@ -455,6 +455,8 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -591,6 +593,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -726,6 +730,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -861,6 +867,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -996,6 +1004,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py index ee666d0e413..67f31c7eda4 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py @@ -372,6 +372,8 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -508,6 +510,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -643,6 +647,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -778,6 +784,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -913,6 +921,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/aio/operations/_operations.py index 52160f16557..fd629488caa 100644 --- a/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/aio/operations/_operations.py @@ -168,6 +168,8 @@ async def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -312,6 +314,8 @@ async def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/operations/_operations.py index 3bdf741aee6..54343f54cf6 100644 --- a/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-basic/parameters/basic/operations/_operations.py @@ -199,6 +199,8 @@ def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -343,6 +345,8 @@ def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py index a5c65def8d7..5b198149e43 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py @@ -176,6 +176,8 @@ async def set( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -298,6 +300,8 @@ async def omit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -420,6 +424,8 @@ async def required_explicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -539,6 +545,8 @@ async def required_implicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py index 6633ac21bfb..f6bfd2dee29 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py @@ -230,6 +230,8 @@ def set( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -352,6 +354,8 @@ def omit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -474,6 +478,8 @@ def required_explicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -593,6 +599,8 @@ def required_implicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py index a22be2e606b..eb3e7b28719 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py @@ -95,6 +95,8 @@ async def multi( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -139,6 +141,8 @@ async def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -183,6 +187,8 @@ async def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -229,6 +235,8 @@ async def pipes( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -273,6 +281,8 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -335,6 +345,8 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py index 4479fa0893e..f34a04c0e42 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py @@ -162,6 +162,8 @@ def multi(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -206,6 +208,8 @@ def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -250,6 +254,8 @@ def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -294,6 +300,8 @@ def pipes(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -338,6 +346,8 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -400,6 +410,8 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py index 93e59ac6299..2af33befef4 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py @@ -177,6 +177,8 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -296,6 +298,8 @@ async def spread_composite_request_only_with_body( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -345,6 +349,8 @@ async def spread_composite_request_without_body( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -488,6 +494,8 @@ async def spread_composite_request( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -631,6 +639,8 @@ async def spread_composite_request_mix( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -775,6 +785,8 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -925,6 +937,8 @@ async def spread_as_request_parameter( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1131,6 +1145,8 @@ async def spread_with_multiple_parameters( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py index c03b4ea4050..5e5b2ad1c4f 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py @@ -322,6 +322,8 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -441,6 +443,8 @@ def spread_composite_request_only_with_body( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -490,6 +494,8 @@ def spread_composite_request_without_body( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -633,6 +639,8 @@ def spread_composite_request( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -776,6 +784,8 @@ def spread_composite_request_mix( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -920,6 +930,8 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1070,6 +1082,8 @@ def spread_as_request_parameter( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1276,6 +1290,8 @@ def spread_with_multiple_parameters( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py index 26c322ee5e0..755ff4644ac 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py @@ -98,6 +98,8 @@ async def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -196,6 +198,8 @@ async def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py index 81f0e65d09a..bd30008cc58 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py @@ -150,6 +150,8 @@ def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -248,6 +250,8 @@ def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py index 15d5a724927..963255b8351 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py @@ -149,6 +149,8 @@ async def basic( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -261,6 +263,8 @@ async def complex( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -359,6 +363,8 @@ async def json_part( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -455,6 +461,8 @@ async def binary_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -559,6 +567,8 @@ async def json_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -655,6 +665,8 @@ async def multi_binary_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -751,6 +763,8 @@ async def check_file_name_and_content_type( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -852,6 +866,8 @@ async def anonymous_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py index 59063eca2bf..f069056292a 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py @@ -218,6 +218,8 @@ def basic( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -330,6 +332,8 @@ def complex( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -428,6 +432,8 @@ def json_part( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -522,6 +528,8 @@ def binary_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -624,6 +632,8 @@ def json_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -718,6 +728,8 @@ def multi_binary_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -814,6 +826,8 @@ def check_file_name_and_content_type( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -913,6 +927,8 @@ def anonymous_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py index cf0a623a1c9..0718a611aac 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -127,6 +127,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 4d39a93d25c..8bb75318c36 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -104,6 +104,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py index 59faa2bec50..4dd5880b8be 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py @@ -119,6 +119,8 @@ def from_none(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -174,6 +176,8 @@ def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -228,6 +232,8 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py index 08566953e65..c5614a26529 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py @@ -83,6 +83,8 @@ async def from_none(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -138,6 +140,8 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -192,6 +196,8 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index d708dd0ac86..354843865d9 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -143,6 +143,8 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -197,6 +199,8 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -258,6 +262,8 @@ def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -318,6 +324,8 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index 38b95f2b9fe..8e676ee7014 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -87,6 +87,8 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -141,6 +143,8 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -202,6 +206,8 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -262,6 +268,8 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py index 494103668c1..5013bf079ef 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py @@ -167,6 +167,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py index 63774699dd7..4e36e19995b 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py @@ -198,6 +198,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py index 68e52371c3c..5a00aabdd1c 100644 --- a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py @@ -82,6 +82,8 @@ def valid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py index 00fd2be6927..03952918312 100644 --- a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py @@ -72,6 +72,8 @@ async def valid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py index b2c8760f979..2e35973f066 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py @@ -97,6 +97,8 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -147,6 +149,8 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py index 3f4af52c55e..981b4b49923 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py @@ -76,6 +76,8 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -126,6 +128,8 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py index 0934628b3df..c80ffde3bfd 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py @@ -82,6 +82,8 @@ def my_op(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py index 1760ae588d4..a79a9159c1f 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py @@ -72,6 +72,8 @@ async def my_op(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py index 4913fe97331..17d80780de1 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py @@ -111,6 +111,8 @@ def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -157,6 +159,8 @@ def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +207,8 @@ def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py index 4f5be4d8039..954f0e64066 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py @@ -76,6 +76,8 @@ async def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -122,6 +124,8 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -168,6 +172,8 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py index 26c526c8c5b..32a96dd84e7 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py @@ -122,6 +122,8 @@ def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -168,6 +170,8 @@ def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -214,6 +218,8 @@ def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -260,6 +266,8 @@ def with_query_old_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py index 9d285ce9542..f77fbdfc2ca 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py @@ -77,6 +77,8 @@ async def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -123,6 +125,8 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -169,6 +173,8 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -215,6 +221,8 @@ async def with_query_old_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py index 70bb8dc9b16..0f9af603eb6 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py @@ -128,6 +128,8 @@ def post_if_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -184,6 +186,8 @@ def post_if_none_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py index 4109efc31d4..a155a3322cf 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py @@ -89,6 +89,8 @@ async def post_if_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -145,6 +147,8 @@ async def post_if_none_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py index fb0a8e67400..5505fa908ae 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py @@ -92,6 +92,8 @@ def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py index 9760cad5a2f..306f8c21abc 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py index 9b2143d2646..f102bd71210 100644 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py @@ -269,6 +269,8 @@ async def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -388,6 +390,8 @@ async def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -507,6 +511,8 @@ async def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -626,6 +632,8 @@ async def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -745,6 +753,8 @@ async def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -864,6 +874,8 @@ async def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -983,6 +995,8 @@ async def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1102,6 +1116,8 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1221,6 +1237,8 @@ async def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1340,6 +1358,8 @@ async def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1459,6 +1479,8 @@ async def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1578,6 +1600,8 @@ async def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1697,6 +1721,8 @@ async def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1816,6 +1842,8 @@ async def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1935,6 +1963,8 @@ async def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2054,6 +2084,8 @@ async def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2173,6 +2205,8 @@ async def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2292,6 +2326,8 @@ async def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2411,6 +2447,8 @@ async def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2530,6 +2568,8 @@ async def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2649,6 +2689,8 @@ async def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2768,6 +2810,8 @@ async def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2887,6 +2931,8 @@ async def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3006,6 +3052,8 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3125,6 +3173,8 @@ async def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3244,6 +3294,8 @@ async def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3363,6 +3415,8 @@ async def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3482,6 +3536,8 @@ async def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3601,6 +3657,8 @@ async def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3720,6 +3778,8 @@ async def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3839,6 +3899,8 @@ async def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3958,6 +4020,8 @@ async def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4077,6 +4141,8 @@ async def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4214,6 +4280,8 @@ async def same_as_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4273,6 +4341,8 @@ async def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4314,6 +4384,8 @@ async def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4355,6 +4427,8 @@ async def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4396,6 +4470,8 @@ async def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4437,6 +4513,8 @@ async def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4478,6 +4556,8 @@ async def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4519,6 +4599,8 @@ async def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4560,6 +4642,8 @@ async def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4601,6 +4685,8 @@ async def continue_method(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4642,6 +4728,8 @@ async def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4683,6 +4771,8 @@ async def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4724,6 +4814,8 @@ async def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4765,6 +4857,8 @@ async def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4806,6 +4900,8 @@ async def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4847,6 +4943,8 @@ async def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4888,6 +4986,8 @@ async def finally_method(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4929,6 +5029,8 @@ async def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4970,6 +5072,8 @@ async def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5011,6 +5115,8 @@ async def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5052,6 +5158,8 @@ async def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5093,6 +5201,8 @@ async def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5134,6 +5244,8 @@ async def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5175,6 +5287,8 @@ async def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5216,6 +5330,8 @@ async def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5257,6 +5373,8 @@ async def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5298,6 +5416,8 @@ async def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5339,6 +5459,8 @@ async def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5380,6 +5502,8 @@ async def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5421,6 +5545,8 @@ async def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5462,6 +5588,8 @@ async def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5503,6 +5631,8 @@ async def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5544,6 +5674,8 @@ async def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5585,6 +5717,8 @@ async def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5649,6 +5783,8 @@ async def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5695,6 +5831,8 @@ async def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5741,6 +5879,8 @@ async def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5787,6 +5927,8 @@ async def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5833,6 +5975,8 @@ async def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5879,6 +6023,8 @@ async def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5925,6 +6071,8 @@ async def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5971,6 +6119,8 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6017,6 +6167,8 @@ async def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6063,6 +6215,8 @@ async def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6109,6 +6263,8 @@ async def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6155,6 +6311,8 @@ async def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6201,6 +6359,8 @@ async def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6247,6 +6407,8 @@ async def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6293,6 +6455,8 @@ async def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6339,6 +6503,8 @@ async def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6385,6 +6551,8 @@ async def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6431,6 +6599,8 @@ async def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6477,6 +6647,8 @@ async def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6523,6 +6695,8 @@ async def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6569,6 +6743,8 @@ async def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6615,6 +6791,8 @@ async def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6661,6 +6839,8 @@ async def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6707,6 +6887,8 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6753,6 +6935,8 @@ async def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6799,6 +6983,8 @@ async def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6845,6 +7031,8 @@ async def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6891,6 +7079,8 @@ async def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6937,6 +7127,8 @@ async def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6983,6 +7175,8 @@ async def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7029,6 +7223,8 @@ async def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7075,6 +7271,8 @@ async def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7121,6 +7319,8 @@ async def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7167,6 +7367,8 @@ async def with_cancellation_token( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py b/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py index c5797561ed0..c39c65bfae8 100644 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py @@ -1289,6 +1289,8 @@ def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1408,6 +1410,8 @@ def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1527,6 +1531,8 @@ def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1646,6 +1652,8 @@ def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1765,6 +1773,8 @@ def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1884,6 +1894,8 @@ def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2003,6 +2015,8 @@ def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2122,6 +2136,8 @@ def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2241,6 +2257,8 @@ def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2360,6 +2378,8 @@ def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2479,6 +2499,8 @@ def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2598,6 +2620,8 @@ def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2717,6 +2741,8 @@ def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2836,6 +2862,8 @@ def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2955,6 +2983,8 @@ def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3074,6 +3104,8 @@ def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3193,6 +3225,8 @@ def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3312,6 +3346,8 @@ def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3431,6 +3467,8 @@ def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3550,6 +3588,8 @@ def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3669,6 +3709,8 @@ def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3788,6 +3830,8 @@ def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3907,6 +3951,8 @@ def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4026,6 +4072,8 @@ def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4145,6 +4193,8 @@ def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4264,6 +4314,8 @@ def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4383,6 +4435,8 @@ def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4502,6 +4556,8 @@ def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4621,6 +4677,8 @@ def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4740,6 +4798,8 @@ def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4859,6 +4919,8 @@ def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4978,6 +5040,8 @@ def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5097,6 +5161,8 @@ def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5234,6 +5300,8 @@ def same_as_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5293,6 +5361,8 @@ def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5334,6 +5404,8 @@ def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5375,6 +5447,8 @@ def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5416,6 +5490,8 @@ def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5457,6 +5533,8 @@ def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5498,6 +5576,8 @@ def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5539,6 +5619,8 @@ def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5580,6 +5662,8 @@ def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5621,6 +5705,8 @@ def continue_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5662,6 +5748,8 @@ def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5703,6 +5791,8 @@ def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5744,6 +5834,8 @@ def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5785,6 +5877,8 @@ def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5826,6 +5920,8 @@ def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5867,6 +5963,8 @@ def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5908,6 +6006,8 @@ def finally_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5949,6 +6049,8 @@ def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5990,6 +6092,8 @@ def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6031,6 +6135,8 @@ def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6072,6 +6178,8 @@ def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6113,6 +6221,8 @@ def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6154,6 +6264,8 @@ def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6195,6 +6307,8 @@ def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6236,6 +6350,8 @@ def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6277,6 +6393,8 @@ def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6318,6 +6436,8 @@ def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6359,6 +6479,8 @@ def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6400,6 +6522,8 @@ def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6441,6 +6565,8 @@ def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6482,6 +6608,8 @@ def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6523,6 +6651,8 @@ def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6564,6 +6694,8 @@ def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6605,6 +6737,8 @@ def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6667,6 +6801,8 @@ def with_and(self, *, and_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6711,6 +6847,8 @@ def with_as(self, *, as_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6757,6 +6895,8 @@ def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6803,6 +6943,8 @@ def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6849,6 +6991,8 @@ def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6895,6 +7039,8 @@ def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6941,6 +7087,8 @@ def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6987,6 +7135,8 @@ def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7033,6 +7183,8 @@ def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7077,6 +7229,8 @@ def with_def(self, *, def_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7121,6 +7275,8 @@ def with_del(self, *, del_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7167,6 +7323,8 @@ def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7213,6 +7371,8 @@ def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7259,6 +7419,8 @@ def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7305,6 +7467,8 @@ def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7351,6 +7515,8 @@ def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7395,6 +7561,8 @@ def with_for(self, *, for_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7441,6 +7609,8 @@ def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7487,6 +7657,8 @@ def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7531,6 +7703,8 @@ def with_if(self, *, if_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7577,6 +7751,8 @@ def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7621,6 +7797,8 @@ def with_in(self, *, in_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7665,6 +7843,8 @@ def with_is(self, *, is_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7711,6 +7891,8 @@ def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7755,6 +7937,8 @@ def with_not(self, *, not_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7799,6 +7983,8 @@ def with_or(self, *, or_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7845,6 +8031,8 @@ def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7891,6 +8079,8 @@ def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7937,6 +8127,8 @@ def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7981,6 +8173,8 @@ def with_try(self, *, try_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8027,6 +8221,8 @@ def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8073,6 +8269,8 @@ def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8119,6 +8317,8 @@ def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8165,6 +8365,8 @@ def with_cancellation_token( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py index d2997bfcae2..af92a63b5e9 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py @@ -230,6 +230,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -401,6 +403,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -572,6 +576,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -743,6 +749,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -914,6 +922,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1085,6 +1095,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1256,6 +1268,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1427,6 +1441,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1608,6 +1624,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1779,6 +1797,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1950,6 +1970,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2121,6 +2143,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2292,6 +2316,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2473,6 +2499,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py index 3e9ab3dcf9c..9ebe9c719c4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py @@ -596,6 +596,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -767,6 +769,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -938,6 +942,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1109,6 +1115,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1280,6 +1288,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1451,6 +1461,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1622,6 +1634,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1793,6 +1807,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1974,6 +1990,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2145,6 +2163,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2316,6 +2336,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2487,6 +2509,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2658,6 +2682,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2839,6 +2865,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py index 3d66923dbbd..ca1729182b6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py @@ -224,6 +224,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -395,6 +397,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -566,6 +570,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -737,6 +743,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -908,6 +916,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1079,6 +1089,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1250,6 +1262,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1421,6 +1435,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1602,6 +1618,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1783,6 +1801,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1954,6 +1974,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py index c1dc7360d7d..6e57be3793c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py @@ -512,6 +512,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -683,6 +685,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -854,6 +858,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1025,6 +1031,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1196,6 +1204,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1367,6 +1377,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1538,6 +1550,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1709,6 +1723,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1890,6 +1906,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2071,6 +2089,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2242,6 +2262,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py index 545c4f7c5d9..7a240cda2ad 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py @@ -202,6 +202,8 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -253,6 +255,8 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py index a9e7257672f..5a318b8144f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py @@ -254,6 +254,8 @@ def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -305,6 +307,8 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py index ab786d2bbdb..0409b987dda 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py @@ -151,6 +151,8 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -202,6 +204,8 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py index 4ebfda45598..48a555847d4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py @@ -190,6 +190,8 @@ def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -241,6 +243,8 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py index 72f77091df0..b1904a60d44 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py @@ -197,6 +197,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py index 887bad56283..f75ad824a68 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py @@ -153,6 +153,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py index 13d6af83a66..d6402ef4af9 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py @@ -359,6 +359,8 @@ def put_extensible_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -687,6 +689,8 @@ def put_fixed_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py index 8c0ad2dc4ea..06956ce95cc 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py @@ -241,6 +241,8 @@ async def put_extensible_model( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -571,6 +573,8 @@ async def put_fixed_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py index 912aa778eb1..9a1ed4c1f81 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py @@ -384,6 +384,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -639,6 +641,8 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py index deafbd84734..3822abe7a91 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py @@ -296,6 +296,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -551,6 +553,8 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py index cb6cc288638..d984b500d30 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py @@ -205,6 +205,8 @@ def post_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py index f286f6752a9..ea98947e334 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py @@ -161,6 +161,8 @@ async def post_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py index af5a2f28f2f..39096ef9be3 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py @@ -190,6 +190,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py index 73bee0e1984..bf5b5a143ef 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py @@ -159,6 +159,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py index b862d165332..7f2b693bbf2 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py @@ -416,6 +416,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -689,6 +691,8 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py index 88da38a445f..bfbb41add14 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py @@ -315,6 +315,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -588,6 +590,8 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py index 55fa5971587..9d882188d83 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py @@ -201,6 +201,8 @@ def input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py index df3428625e6..3b68d224775 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py @@ -157,6 +157,8 @@ async def input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py index 20436f3092c..853dfb95e55 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py @@ -455,6 +455,8 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -591,6 +593,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -726,6 +730,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -861,6 +867,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -996,6 +1004,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py index b0d7255135a..b70e1c2466d 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py @@ -372,6 +372,8 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -508,6 +510,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -643,6 +647,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -778,6 +784,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -913,6 +921,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py index 009241f970e..d2fafd150c0 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py @@ -293,6 +293,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -504,6 +506,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -736,6 +740,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -934,6 +940,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1142,6 +1150,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1374,6 +1384,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1572,6 +1584,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1770,6 +1784,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1966,6 +1982,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2164,6 +2182,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2362,6 +2382,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2558,6 +2580,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2762,6 +2786,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2966,6 +2992,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3168,6 +3196,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3384,6 +3414,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3594,6 +3626,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3803,6 +3837,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4001,6 +4037,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4199,6 +4237,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4397,6 +4437,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4595,6 +4637,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4796,6 +4840,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4997,6 +5043,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5204,6 +5252,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5417,6 +5467,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5614,6 +5666,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5811,6 +5865,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6009,6 +6065,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6211,6 +6269,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6415,6 +6475,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6619,6 +6681,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py index b77c203e539..c66c01f7613 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py @@ -1143,6 +1143,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1354,6 +1356,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1586,6 +1590,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1784,6 +1790,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1992,6 +2000,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2224,6 +2234,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2422,6 +2434,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2620,6 +2634,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2816,6 +2832,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3014,6 +3032,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3212,6 +3232,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3408,6 +3430,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3612,6 +3636,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3816,6 +3842,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4018,6 +4046,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4234,6 +4264,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4444,6 +4476,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4653,6 +4687,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4851,6 +4887,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5049,6 +5087,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5247,6 +5287,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5445,6 +5487,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5646,6 +5690,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5847,6 +5893,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6054,6 +6102,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6267,6 +6317,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6464,6 +6516,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6661,6 +6715,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6859,6 +6915,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7061,6 +7119,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7265,6 +7325,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7469,6 +7531,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py index 57fe6465387..3a94dbf6f2f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py @@ -316,6 +316,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -437,6 +439,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -694,6 +698,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -815,6 +821,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1072,6 +1080,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1193,6 +1203,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1450,6 +1462,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1571,6 +1585,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1840,6 +1856,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1969,6 +1987,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2248,6 +2268,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2381,6 +2403,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2653,6 +2677,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2783,6 +2809,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py index 10c1b9971ce..46da69727c0 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py @@ -682,6 +682,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -803,6 +805,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1060,6 +1064,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1181,6 +1187,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1438,6 +1446,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1559,6 +1569,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1816,6 +1828,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1937,6 +1951,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2206,6 +2222,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2335,6 +2353,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2614,6 +2634,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2747,6 +2769,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3019,6 +3043,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3149,6 +3175,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py index 0b78879d843..b940e128093 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py @@ -340,6 +340,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -459,6 +461,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -712,6 +716,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -831,6 +837,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1084,6 +1092,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1203,6 +1213,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1456,6 +1468,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1575,6 +1589,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1836,6 +1852,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1959,6 +1977,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2230,6 +2250,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2357,6 +2379,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2610,6 +2634,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2729,6 +2755,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2982,6 +3010,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3101,6 +3131,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3354,6 +3386,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3473,6 +3507,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3726,6 +3762,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3845,6 +3883,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4101,6 +4141,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4221,6 +4263,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4474,6 +4518,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4593,6 +4639,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4849,6 +4897,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4969,6 +5019,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5229,6 +5281,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5351,6 +5405,8 @@ async def put_required_only( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py index 8c5229144fc..f8ccbbaec9e 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py @@ -1074,6 +1074,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1193,6 +1195,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1446,6 +1450,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1565,6 +1571,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1818,6 +1826,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1937,6 +1947,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2190,6 +2202,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2309,6 +2323,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2570,6 +2586,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2693,6 +2711,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2964,6 +2984,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3091,6 +3113,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3344,6 +3368,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3463,6 +3489,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3716,6 +3744,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3835,6 +3865,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4088,6 +4120,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4207,6 +4241,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4460,6 +4496,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4579,6 +4617,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4835,6 +4875,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4955,6 +4997,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5208,6 +5252,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5327,6 +5373,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5583,6 +5631,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5703,6 +5753,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5963,6 +6015,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6085,6 +6139,8 @@ def put_required_only( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py index 5ee006ceeae..84b68f7b6af 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py @@ -284,6 +284,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -479,6 +481,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -674,6 +678,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -869,6 +875,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1064,6 +1072,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1259,6 +1269,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1454,6 +1466,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1649,6 +1663,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1844,6 +1860,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2039,6 +2057,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2235,6 +2255,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2436,6 +2458,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2639,6 +2663,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2841,6 +2867,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3050,6 +3078,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3253,6 +3283,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3436,6 +3468,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3632,6 +3666,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3827,6 +3863,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4023,6 +4061,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4219,6 +4259,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4415,6 +4457,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4610,6 +4654,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4806,6 +4852,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5002,6 +5050,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5200,6 +5250,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5396,6 +5448,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5593,6 +5647,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5789,6 +5845,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py index 108a8ee2b6d..d7d95965d4e 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py @@ -1040,6 +1040,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1235,6 +1237,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1430,6 +1434,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1625,6 +1631,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1820,6 +1828,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2015,6 +2025,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2210,6 +2222,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2405,6 +2419,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2600,6 +2616,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2795,6 +2813,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2991,6 +3011,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3192,6 +3214,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3395,6 +3419,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3597,6 +3623,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3806,6 +3834,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4009,6 +4039,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4192,6 +4224,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4388,6 +4422,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4583,6 +4619,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4779,6 +4817,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4975,6 +5015,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5171,6 +5213,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5366,6 +5410,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5562,6 +5608,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5758,6 +5806,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5956,6 +6006,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6152,6 +6204,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6349,6 +6403,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6545,6 +6601,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py index 4920ce749d3..26158ed8a16 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py @@ -161,6 +161,8 @@ async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -277,6 +279,8 @@ async def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -393,6 +397,8 @@ async def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -511,6 +517,8 @@ async def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -557,6 +565,8 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -675,6 +685,8 @@ async def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -721,6 +733,8 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -847,6 +861,8 @@ async def verify( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -973,6 +989,8 @@ async def verify( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py index 1d64091c017..dfeac6da574 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py @@ -364,6 +364,8 @@ def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -480,6 +482,8 @@ def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -596,6 +600,8 @@ def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -714,6 +720,8 @@ def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -760,6 +768,8 @@ def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -878,6 +888,8 @@ def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -924,6 +936,8 @@ def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1048,6 +1062,8 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1172,6 +1188,8 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py index 51ea1b0ff43..0b7c8657a2c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py @@ -256,6 +256,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -462,6 +464,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -672,6 +676,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -874,6 +880,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1076,6 +1084,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1284,6 +1294,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1495,6 +1507,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1706,6 +1720,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1923,6 +1939,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2179,6 +2197,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py index 8430ec7cf18..19ce8243f61 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py @@ -518,6 +518,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -724,6 +726,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -934,6 +938,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1136,6 +1142,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1338,6 +1346,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1546,6 +1556,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1757,6 +1769,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1968,6 +1982,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2185,6 +2201,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2441,6 +2459,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp index 28023f7a915..92869fb261d 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp @@ -136,23 +136,9 @@ interface Catalogs { uploadImage is ArmResourceActionNoResponseContentAsync; } -@@doc(Catalogs.listDeviceGroups::parameters.body, - "List device groups for catalog." -); -@@encodedName(Catalogs.listDeviceGroups::parameters.body, - "application/json", - "listDeviceGroupsRequest" -); -@@extension(Catalogs.listDeviceGroups::parameters.body, - "x-ms-client-name", - "listDeviceGroupsRequest" -); +@@doc(Catalogs.listDeviceGroups::parameters.body, "List device groups for catalog."); +@@encodedName(Catalogs.listDeviceGroups::parameters.body, "application/json", "listDeviceGroupsRequest"); +@@extension(Catalogs.listDeviceGroups::parameters.body, "x-ms-client-name", "listDeviceGroupsRequest"); @@doc(Catalogs.uploadImage::parameters.body, "Image upload request body."); -@@encodedName(Catalogs.uploadImage::parameters.body, - "application/json", - "uploadImageRequest" -); -@@extension(Catalogs.uploadImage::parameters.body, - "x-ms-client-name", - "uploadImageRequest" -); +@@encodedName(Catalogs.uploadImage::parameters.body, "application/json", "uploadImageRequest"); +@@extension(Catalogs.uploadImage::parameters.body, "x-ms-client-name", "uploadImageRequest"); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp index 3f33f1a9376..c4c3c826d41 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp @@ -52,11 +52,7 @@ interface Certificates { /** * Retrieves cert chain. */ - retrieveCertChain is ArmResourceActionSync< - Certificate, - void, - CertificateChainResponse - >; + retrieveCertChain is ArmResourceActionSync; /** * Gets the proof of possession nonce. @@ -68,9 +64,7 @@ interface Certificates { >; } -@@doc(Certificates.retrieveProofOfPossessionNonce::parameters.body, - "Proof of possession nonce request body " -); +@@doc(Certificates.retrieveProofOfPossessionNonce::parameters.body, "Proof of possession nonce request body "); @@encodedName(Certificates.retrieveProofOfPossessionNonce::parameters.body, "application/json", "proofOfPossessionNonceRequest" diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp index beb00e0ae23..c112891376d 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp @@ -45,11 +45,7 @@ interface Devices { */ #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "Existing API" @parameterVisibility - update is ArmCustomPatchAsync< - Device, - DeviceUpdate, - LroHeaders = Azure.Core.Foundations.RetryAfterHeader - >; + update is ArmCustomPatchAsync; /** * Delete a Device @@ -73,14 +69,6 @@ interface Devices { >; } -@@doc(Devices.generateCapabilityImage::parameters.body, - "Generate capability image request body." -); -@@encodedName(Devices.generateCapabilityImage::parameters.body, - "application/json", - "generateDeviceCapabilityRequest" -); -@@extension(Devices.generateCapabilityImage::parameters.body, - "x-ms-client-name", - "generateDeviceCapabilityRequest" -); +@@doc(Devices.generateCapabilityImage::parameters.body, "Generate capability image request body."); +@@encodedName(Devices.generateCapabilityImage::parameters.body, "application/json", "generateDeviceCapabilityRequest"); +@@extension(Devices.generateCapabilityImage::parameters.body, "x-ms-client-name", "generateDeviceCapabilityRequest"); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp index d050170ec64..d0b8445f4e0 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp @@ -70,29 +70,14 @@ interface DeviceGroups { /** * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. */ - claimDevices is ArmResourceActionNoResponseContentAsync< - DeviceGroup, - ClaimDevicesRequest - >; + claimDevices is ArmResourceActionNoResponseContentAsync; /** * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ - countDevices is ArmResourceActionSync< - DeviceGroup, - void, - CountDevicesResponse - >; + countDevices is ArmResourceActionSync; } -@@doc(DeviceGroups.claimDevices::parameters.body, - "Bulk claim devices request body." -); -@@encodedName(DeviceGroups.claimDevices::parameters.body, - "application/json", - "claimDevicesRequest" -); -@@extension(DeviceGroups.claimDevices::parameters.body, - "x-ms-client-name", - "claimDevicesRequest" -); +@@doc(DeviceGroups.claimDevices::parameters.body, "Bulk claim devices request body."); +@@encodedName(DeviceGroups.claimDevices::parameters.body, "application/json", "claimDevicesRequest"); +@@extension(DeviceGroups.claimDevices::parameters.body, "x-ms-client-name", "claimDevicesRequest"); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp index fd663a74bb1..1281b8a106d 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp @@ -66,9 +66,5 @@ interface Products { /** * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ - generateDefaultDeviceGroups is ArmResourceActionSync< - Product, - void, - ResourceListResult - >; + generateDefaultDeviceGroups is ArmResourceActionSync>; } diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py index 970b4996029..95c7f37973b 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py @@ -94,6 +94,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py index 03e151e9ece..15416c4139c 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -115,6 +117,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py index c223fd6f781..29ac8434b78 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py @@ -94,6 +94,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py index b466034ad5d..c7b907500ba 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -115,6 +117,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py index 2333347b1ab..7e6328c695c 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py @@ -94,6 +94,8 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -140,6 +142,8 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py index 3a416eedcd0..b2c4462eec3 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py @@ -69,6 +69,8 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -115,6 +117,8 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py index 19b6681c077..07f84082723 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py @@ -84,6 +84,8 @@ def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -124,6 +126,8 @@ def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py index 2b44ae0c516..4f974e25752 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py @@ -67,6 +67,8 @@ async def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -107,6 +109,8 @@ async def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py index 848e70f7ff6..9cca01b8ecf 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py @@ -178,6 +178,8 @@ async def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -296,6 +298,8 @@ async def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -363,6 +367,8 @@ async def union_enum_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -412,6 +418,8 @@ async def union_enum_member_name( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -455,6 +463,8 @@ async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -500,6 +510,8 @@ async def parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -618,6 +630,8 @@ async def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -736,6 +750,8 @@ async def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -855,6 +871,8 @@ async def compatible_with_encoded_name( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -900,6 +918,8 @@ async def request( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -940,6 +960,8 @@ async def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py index f5b7991503b..e65fec7f132 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py @@ -303,6 +303,8 @@ def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -421,6 +423,8 @@ def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -488,6 +492,8 @@ def union_enum_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -537,6 +543,8 @@ def union_enum_member_name( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -580,6 +588,8 @@ def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -623,6 +633,8 @@ def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -741,6 +753,8 @@ def client( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -859,6 +873,8 @@ def language( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -978,6 +994,8 @@ def compatible_with_encoded_name( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1021,6 +1039,8 @@ def request(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1061,6 +1081,8 @@ def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py index 78f6be1eab3..48e87feed5a 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py @@ -118,6 +118,8 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -180,6 +182,8 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -224,6 +228,8 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -286,6 +292,8 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -330,6 +338,8 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -377,6 +387,8 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -421,6 +433,8 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -483,6 +497,8 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -545,6 +561,8 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py index 18537d47418..df841c535e7 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py @@ -174,6 +174,8 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -236,6 +238,8 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -280,6 +284,8 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -342,6 +348,8 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -386,6 +394,8 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -433,6 +443,8 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -477,6 +489,8 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -539,6 +553,8 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -601,6 +617,8 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py index 187806824a3..6daf746704e 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py @@ -116,6 +116,8 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -160,6 +162,8 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -204,6 +208,8 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -251,6 +257,8 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -295,6 +303,8 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -339,6 +349,8 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py index ac672ea04b5..84308ef96f4 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py @@ -78,6 +78,8 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -122,6 +124,8 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -166,6 +170,8 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -213,6 +219,8 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -257,6 +265,8 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -301,6 +311,8 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py index 4e80b55d65d..3dba5917e2c 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py @@ -93,6 +93,8 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -137,6 +139,8 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -181,6 +185,8 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -228,6 +234,8 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -272,6 +280,8 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -316,6 +326,8 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py index 76899e5ace0..b6348b71c4f 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py @@ -131,6 +131,8 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -175,6 +177,8 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -219,6 +223,8 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -266,6 +272,8 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -310,6 +318,8 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -354,6 +364,8 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py index 2149c49836b..34e4f1f4257 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py @@ -92,6 +92,8 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -136,6 +138,8 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -180,6 +184,8 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -242,6 +248,8 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -286,6 +294,8 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -330,6 +340,8 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py index 6c386779be2..c6040c1c782 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py @@ -130,6 +130,8 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -174,6 +176,8 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -218,6 +222,8 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -280,6 +286,8 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -324,6 +332,8 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -368,6 +378,8 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py index ed12cf9d05d..c0c13556113 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py @@ -113,6 +113,8 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -156,6 +158,8 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -199,6 +203,8 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +250,8 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -952,6 +960,8 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -995,6 +1005,8 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1038,6 +1050,8 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1083,6 +1097,8 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1148,6 +1164,8 @@ async def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1195,6 +1213,8 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1244,6 +1264,8 @@ async def custom_content_type( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1291,6 +1313,8 @@ async def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1338,6 +1362,8 @@ async def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py index acaafa6c798..cbc8549bb65 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py @@ -392,6 +392,8 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -435,6 +437,8 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -478,6 +482,8 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -523,6 +529,8 @@ def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1231,6 +1239,8 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1274,6 +1284,8 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1317,6 +1329,8 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1362,6 +1376,8 @@ def base64url_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1427,6 +1443,8 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1474,6 +1492,8 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1523,6 +1543,8 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1570,6 +1592,8 @@ def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1617,6 +1641,8 @@ def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py index 75561787219..532280a6e01 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py @@ -113,6 +113,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -158,6 +160,8 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +207,8 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -248,6 +254,8 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -293,6 +301,8 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1161,6 +1171,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1206,6 +1218,8 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1251,6 +1265,8 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1296,6 +1312,8 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1341,6 +1359,8 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1399,6 +1419,8 @@ async def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1442,6 +1464,8 @@ async def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1485,6 +1509,8 @@ async def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1528,6 +1554,8 @@ async def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py index dee3665cb56..9380d5c0c8a 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py @@ -331,6 +331,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -376,6 +378,8 @@ def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -421,6 +425,8 @@ def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -466,6 +472,8 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -511,6 +519,8 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1379,6 +1389,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1424,6 +1436,8 @@ def rfc3339( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1469,6 +1483,8 @@ def rfc7231( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1514,6 +1530,8 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1559,6 +1577,8 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1617,6 +1637,8 @@ def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1660,6 +1682,8 @@ def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1703,6 +1727,8 @@ def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1746,6 +1772,8 @@ def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py index 5f5d005102d..0d0b7f3c3b1 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py @@ -112,6 +112,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -157,6 +159,8 @@ async def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -202,6 +206,8 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -247,6 +253,8 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -292,6 +300,8 @@ async def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -337,6 +347,8 @@ async def int32_seconds_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1368,6 +1380,8 @@ async def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1413,6 +1427,8 @@ async def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1458,6 +1474,8 @@ async def iso8601_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1503,6 +1521,8 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1548,6 +1568,8 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1593,6 +1615,8 @@ async def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py index 72dd968602e..b69cac95372 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py @@ -342,6 +342,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -387,6 +389,8 @@ def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -430,6 +434,8 @@ def int32_seconds(self, *, input: int, **kwargs: Any) -> None: # pylint: disabl response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -473,6 +479,8 @@ def float_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: disa response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -516,6 +524,8 @@ def float64_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: di response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -561,6 +571,8 @@ def int32_seconds_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1592,6 +1604,8 @@ def default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1637,6 +1651,8 @@ def iso8601( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1682,6 +1698,8 @@ def iso8601_array( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1725,6 +1743,8 @@ def int32_seconds(self, *, duration: int, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1770,6 +1790,8 @@ def float_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1815,6 +1837,8 @@ def float64_seconds( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py index b27cb374942..f3718c8ae03 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py @@ -458,6 +458,8 @@ def head_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -592,6 +594,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -726,6 +730,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -860,6 +866,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -994,6 +1002,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py index d14b1a016d8..34d093bbaa2 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py @@ -375,6 +375,8 @@ async def head_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -509,6 +511,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -643,6 +647,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -777,6 +783,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -911,6 +919,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py index 38898987143..a0ac5c5605a 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py @@ -452,6 +452,8 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -587,6 +589,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -721,6 +725,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -855,6 +861,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -989,6 +997,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py index 1af81a9adf7..8e80e99f6f2 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py @@ -369,6 +369,8 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -504,6 +506,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -638,6 +642,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -772,6 +778,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -906,6 +914,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/aio/operations/_operations.py index 675dfc0003b..2f4780222b5 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/aio/operations/_operations.py @@ -166,6 +166,8 @@ async def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -309,6 +311,8 @@ async def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/operations/_operations.py index b3e65d3c188..a60fbaf09d0 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-basic/parameters/basic/operations/_operations.py @@ -197,6 +197,8 @@ def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -340,6 +342,8 @@ def simple( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py index bad3ee15036..7d1249571dc 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py @@ -174,6 +174,8 @@ async def set( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -295,6 +297,8 @@ async def omit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -416,6 +420,8 @@ async def required_explicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -534,6 +540,8 @@ async def required_implicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py index bd06f619ffb..a8d305b84b6 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py @@ -228,6 +228,8 @@ def set( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -349,6 +351,8 @@ def omit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -470,6 +474,8 @@ def required_explicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -588,6 +594,8 @@ def required_implicit( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py index 69dbb21a836..bc8864a079c 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py @@ -93,6 +93,8 @@ async def multi( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -136,6 +138,8 @@ async def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -179,6 +183,8 @@ async def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -224,6 +230,8 @@ async def pipes( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -267,6 +275,8 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -328,6 +338,8 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py index 2257f96ebdd..d28c8e8524f 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py @@ -160,6 +160,8 @@ def multi(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -203,6 +205,8 @@ def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -246,6 +250,8 @@ def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -289,6 +295,8 @@ def pipes(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -332,6 +340,8 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -393,6 +403,8 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py index aa04301fecf..4202f15a6d9 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py @@ -175,6 +175,8 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -293,6 +295,8 @@ async def spread_composite_request_only_with_body( # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -341,6 +345,8 @@ async def spread_composite_request_without_body( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -483,6 +489,8 @@ async def spread_composite_request( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -625,6 +633,8 @@ async def spread_composite_request_mix( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -768,6 +778,8 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -917,6 +929,8 @@ async def spread_as_request_parameter( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1122,6 +1136,8 @@ async def spread_with_multiple_parameters( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py index e73bbaa3d26..82e367fb56b 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py @@ -320,6 +320,8 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -438,6 +440,8 @@ def spread_composite_request_only_with_body( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -486,6 +490,8 @@ def spread_composite_request_without_body( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -628,6 +634,8 @@ def spread_composite_request( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -770,6 +778,8 @@ def spread_composite_request_mix( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -913,6 +923,8 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1062,6 +1074,8 @@ def spread_as_request_parameter( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1267,6 +1281,8 @@ def spread_with_multiple_parameters( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py index cd8b8333d85..5e12b43861f 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py @@ -96,6 +96,8 @@ async def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -192,6 +194,8 @@ async def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py index 2e601b4637b..9850c980f55 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py @@ -148,6 +148,8 @@ def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -244,6 +246,8 @@ def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py index 0940b8a8adc..190c10b8051 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py @@ -147,6 +147,8 @@ async def basic( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -258,6 +260,8 @@ async def complex( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -355,6 +359,8 @@ async def json_part( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -450,6 +456,8 @@ async def binary_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -553,6 +561,8 @@ async def json_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -648,6 +658,8 @@ async def multi_binary_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -743,6 +755,8 @@ async def check_file_name_and_content_type( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -843,6 +857,8 @@ async def anonymous_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py index 8fbe7477eec..e67cf7cfd2e 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py @@ -216,6 +216,8 @@ def basic( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -327,6 +329,8 @@ def complex( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -424,6 +428,8 @@ def json_part( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -517,6 +523,8 @@ def binary_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -618,6 +626,8 @@ def json_array_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -711,6 +721,8 @@ def multi_binary_parts( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -806,6 +818,8 @@ def check_file_name_and_content_type( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -904,6 +918,8 @@ def anonymous_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py index a8deaa11a03..f94a8ef2746 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -125,6 +125,8 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 84f093181aa..e463da62bdf 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -102,6 +102,8 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py index 8c27bfa6078..16bfb8d71c1 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py @@ -117,6 +117,8 @@ def from_none(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -171,6 +173,8 @@ def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -224,6 +228,8 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py index eb80977912b..de65117b70c 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py @@ -81,6 +81,8 @@ async def from_none(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -135,6 +137,8 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -188,6 +192,8 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 5db950aa54b..1f01e20d2e9 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -141,6 +141,8 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -194,6 +196,8 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -254,6 +258,8 @@ def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -313,6 +319,8 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index f78dbe99139..a4b7cb8f4e4 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -85,6 +85,8 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -138,6 +140,8 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -198,6 +202,8 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -257,6 +263,8 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py index 07bc68875c1..79b572b4266 100644 --- a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py @@ -165,6 +165,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py index 32c9e183166..5e66f513903 100644 --- a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py @@ -196,6 +196,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py index a286fd150f3..c17979d3d3f 100644 --- a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py @@ -80,6 +80,8 @@ def valid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py index 2c3c140ff6e..1c9f53817db 100644 --- a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py @@ -70,6 +70,8 @@ async def valid(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py index 829b302fb68..c082a2077c4 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py @@ -95,6 +95,8 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -144,6 +146,8 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py index 41ebd252911..384934829f5 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py @@ -74,6 +74,8 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -123,6 +125,8 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py index 7abea867f62..5be03443157 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py @@ -80,6 +80,8 @@ def my_op(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py index 5068be84c58..333d9d8dd3b 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py @@ -70,6 +70,8 @@ async def my_op(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py index 0e35913c1c8..130d388af0f 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py @@ -109,6 +109,8 @@ def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -154,6 +156,8 @@ def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -199,6 +203,8 @@ def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py index 5b6490f3da4..e4d12d3815c 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py @@ -74,6 +74,8 @@ async def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -119,6 +121,8 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -164,6 +168,8 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py index 2903e2e9bd4..31979b20734 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py @@ -120,6 +120,8 @@ def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -165,6 +167,8 @@ def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -210,6 +214,8 @@ def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -255,6 +261,8 @@ def with_query_old_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py index c505ac87694..153c1a1d49e 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py @@ -75,6 +75,8 @@ async def without_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -120,6 +122,8 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -165,6 +169,8 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -210,6 +216,8 @@ async def with_query_old_api_version(self, **kwargs: Any) -> bool: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py index a91f67f97d3..9b9486f0208 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py @@ -126,6 +126,8 @@ def post_if_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -181,6 +183,8 @@ def post_if_none_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py index c6a2941e459..3928a511312 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py @@ -87,6 +87,8 @@ async def post_if_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -142,6 +144,8 @@ async def post_if_none_match( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py index d466d3bc71c..c2b6854a444 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py @@ -90,6 +90,8 @@ def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py index 11a1d488033..419f0190eb3 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py @@ -67,6 +67,8 @@ async def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py index c5a4a040296..390caf10b62 100644 --- a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py @@ -267,6 +267,8 @@ async def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -385,6 +387,8 @@ async def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -503,6 +507,8 @@ async def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -621,6 +627,8 @@ async def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -739,6 +747,8 @@ async def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -857,6 +867,8 @@ async def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -975,6 +987,8 @@ async def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1093,6 +1107,8 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1211,6 +1227,8 @@ async def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1329,6 +1347,8 @@ async def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1447,6 +1467,8 @@ async def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1565,6 +1587,8 @@ async def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1683,6 +1707,8 @@ async def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1801,6 +1827,8 @@ async def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1919,6 +1947,8 @@ async def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2037,6 +2067,8 @@ async def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2155,6 +2187,8 @@ async def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2273,6 +2307,8 @@ async def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2391,6 +2427,8 @@ async def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2509,6 +2547,8 @@ async def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2627,6 +2667,8 @@ async def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2745,6 +2787,8 @@ async def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2863,6 +2907,8 @@ async def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2981,6 +3027,8 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3099,6 +3147,8 @@ async def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3217,6 +3267,8 @@ async def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3335,6 +3387,8 @@ async def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3453,6 +3507,8 @@ async def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3571,6 +3627,8 @@ async def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3689,6 +3747,8 @@ async def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3807,6 +3867,8 @@ async def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3925,6 +3987,8 @@ async def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4043,6 +4107,8 @@ async def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4179,6 +4245,8 @@ async def same_as_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4237,6 +4305,8 @@ async def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4277,6 +4347,8 @@ async def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4317,6 +4389,8 @@ async def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4357,6 +4431,8 @@ async def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4397,6 +4473,8 @@ async def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4437,6 +4515,8 @@ async def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4477,6 +4557,8 @@ async def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4517,6 +4599,8 @@ async def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4557,6 +4641,8 @@ async def continue_method(self, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4597,6 +4683,8 @@ async def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4637,6 +4725,8 @@ async def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4677,6 +4767,8 @@ async def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4717,6 +4809,8 @@ async def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4757,6 +4851,8 @@ async def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4797,6 +4893,8 @@ async def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4837,6 +4935,8 @@ async def finally_method(self, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4877,6 +4977,8 @@ async def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4917,6 +5019,8 @@ async def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4957,6 +5061,8 @@ async def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4997,6 +5103,8 @@ async def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5037,6 +5145,8 @@ async def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5077,6 +5187,8 @@ async def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5117,6 +5229,8 @@ async def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5157,6 +5271,8 @@ async def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5197,6 +5313,8 @@ async def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5237,6 +5355,8 @@ async def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5277,6 +5397,8 @@ async def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5317,6 +5439,8 @@ async def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5357,6 +5481,8 @@ async def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5397,6 +5523,8 @@ async def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5437,6 +5565,8 @@ async def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5477,6 +5607,8 @@ async def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5517,6 +5649,8 @@ async def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5580,6 +5714,8 @@ async def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5625,6 +5761,8 @@ async def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5670,6 +5808,8 @@ async def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5715,6 +5855,8 @@ async def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5760,6 +5902,8 @@ async def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5805,6 +5949,8 @@ async def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5850,6 +5996,8 @@ async def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5895,6 +6043,8 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5940,6 +6090,8 @@ async def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5985,6 +6137,8 @@ async def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6030,6 +6184,8 @@ async def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6075,6 +6231,8 @@ async def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6120,6 +6278,8 @@ async def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6165,6 +6325,8 @@ async def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6210,6 +6372,8 @@ async def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6255,6 +6419,8 @@ async def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6300,6 +6466,8 @@ async def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6345,6 +6513,8 @@ async def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6390,6 +6560,8 @@ async def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6435,6 +6607,8 @@ async def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6480,6 +6654,8 @@ async def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6525,6 +6701,8 @@ async def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6570,6 +6748,8 @@ async def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6615,6 +6795,8 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6660,6 +6842,8 @@ async def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6705,6 +6889,8 @@ async def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6750,6 +6936,8 @@ async def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6795,6 +6983,8 @@ async def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6840,6 +7030,8 @@ async def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6885,6 +7077,8 @@ async def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6930,6 +7124,8 @@ async def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6975,6 +7171,8 @@ async def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7020,6 +7218,8 @@ async def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7065,6 +7265,8 @@ async def with_cancellation_token( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py index adf7f842370..3e4000ebc0f 100644 --- a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py @@ -1287,6 +1287,8 @@ def with_and( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1405,6 +1407,8 @@ def with_as( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1523,6 +1527,8 @@ def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1641,6 +1647,8 @@ def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1759,6 +1767,8 @@ def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1877,6 +1887,8 @@ def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1995,6 +2007,8 @@ def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2113,6 +2127,8 @@ def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2231,6 +2247,8 @@ def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2349,6 +2367,8 @@ def with_def( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2467,6 +2487,8 @@ def with_del( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2585,6 +2607,8 @@ def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2703,6 +2727,8 @@ def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2821,6 +2847,8 @@ def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2939,6 +2967,8 @@ def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3057,6 +3087,8 @@ def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3175,6 +3207,8 @@ def with_for( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3293,6 +3327,8 @@ def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3411,6 +3447,8 @@ def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3529,6 +3567,8 @@ def with_if( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3647,6 +3687,8 @@ def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3765,6 +3807,8 @@ def with_in( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3883,6 +3927,8 @@ def with_is( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4001,6 +4047,8 @@ def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4119,6 +4167,8 @@ def with_not( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4237,6 +4287,8 @@ def with_or( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4355,6 +4407,8 @@ def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4473,6 +4527,8 @@ def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4591,6 +4647,8 @@ def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4709,6 +4767,8 @@ def with_try( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4827,6 +4887,8 @@ def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4945,6 +5007,8 @@ def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5063,6 +5127,8 @@ def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5199,6 +5265,8 @@ def same_as_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5257,6 +5325,8 @@ def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5297,6 +5367,8 @@ def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5337,6 +5409,8 @@ def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5377,6 +5451,8 @@ def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5417,6 +5493,8 @@ def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5457,6 +5535,8 @@ def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5497,6 +5577,8 @@ def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5537,6 +5619,8 @@ def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5577,6 +5661,8 @@ def continue_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5617,6 +5703,8 @@ def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5657,6 +5745,8 @@ def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5697,6 +5787,8 @@ def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5737,6 +5829,8 @@ def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5777,6 +5871,8 @@ def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5817,6 +5913,8 @@ def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5857,6 +5955,8 @@ def finally_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5897,6 +5997,8 @@ def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5937,6 +6039,8 @@ def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5977,6 +6081,8 @@ def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6017,6 +6123,8 @@ def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6057,6 +6165,8 @@ def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6097,6 +6207,8 @@ def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6137,6 +6249,8 @@ def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6177,6 +6291,8 @@ def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6217,6 +6333,8 @@ def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6257,6 +6375,8 @@ def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6297,6 +6417,8 @@ def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6337,6 +6459,8 @@ def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6377,6 +6501,8 @@ def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6417,6 +6543,8 @@ def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6457,6 +6585,8 @@ def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6497,6 +6627,8 @@ def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6537,6 +6669,8 @@ def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6598,6 +6732,8 @@ def with_and(self, *, and_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6641,6 +6777,8 @@ def with_as(self, *, as_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6686,6 +6824,8 @@ def with_assert( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6731,6 +6871,8 @@ def with_async( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6776,6 +6918,8 @@ def with_await( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6821,6 +6965,8 @@ def with_break( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6866,6 +7012,8 @@ def with_class( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6911,6 +7059,8 @@ def with_constructor( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6956,6 +7106,8 @@ def with_continue( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6999,6 +7151,8 @@ def with_def(self, *, def_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7042,6 +7196,8 @@ def with_del(self, *, del_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7087,6 +7243,8 @@ def with_elif( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7132,6 +7290,8 @@ def with_else( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7177,6 +7337,8 @@ def with_except( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7222,6 +7384,8 @@ def with_exec( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7267,6 +7431,8 @@ def with_finally( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7310,6 +7476,8 @@ def with_for(self, *, for_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7355,6 +7523,8 @@ def with_from( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7400,6 +7570,8 @@ def with_global( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7443,6 +7615,8 @@ def with_if(self, *, if_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7488,6 +7662,8 @@ def with_import( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7531,6 +7707,8 @@ def with_in(self, *, in_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7574,6 +7752,8 @@ def with_is(self, *, is_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7619,6 +7799,8 @@ def with_lambda( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7662,6 +7844,8 @@ def with_not(self, *, not_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7705,6 +7889,8 @@ def with_or(self, *, or_parameter: str, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7750,6 +7936,8 @@ def with_pass( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7795,6 +7983,8 @@ def with_raise( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7840,6 +8030,8 @@ def with_return( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7883,6 +8075,8 @@ def with_try(self, *, try_parameter: str, **kwargs: Any) -> None: # pylint: dis response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7928,6 +8122,8 @@ def with_while( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7973,6 +8169,8 @@ def with_with( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8018,6 +8216,8 @@ def with_yield( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -8063,6 +8263,8 @@ def with_cancellation_token( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py index 4f5097533aa..1baa30ba872 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py @@ -227,6 +227,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -396,6 +398,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -565,6 +569,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -734,6 +740,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -903,6 +911,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1072,6 +1082,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1241,6 +1253,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1410,6 +1424,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1589,6 +1605,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1758,6 +1776,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1927,6 +1947,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2096,6 +2118,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2265,6 +2289,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2444,6 +2470,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py index ec51e676f22..a4caa3e0940 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py @@ -593,6 +593,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -762,6 +764,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -931,6 +935,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1100,6 +1106,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1269,6 +1277,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1438,6 +1448,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1607,6 +1619,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1776,6 +1790,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1955,6 +1971,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2124,6 +2142,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2293,6 +2313,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2462,6 +2484,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2631,6 +2655,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2810,6 +2836,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py index 735c0e1ebd7..53e1b0f54e4 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py @@ -221,6 +221,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -390,6 +392,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -559,6 +563,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -728,6 +734,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -897,6 +905,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1066,6 +1076,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1235,6 +1247,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1404,6 +1418,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1583,6 +1599,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1762,6 +1780,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1931,6 +1951,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py index 3f3eabb01e4..99e1b733b93 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py @@ -509,6 +509,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -678,6 +680,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -847,6 +851,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1016,6 +1022,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1185,6 +1193,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1354,6 +1364,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1523,6 +1535,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1692,6 +1706,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1871,6 +1887,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2050,6 +2068,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2219,6 +2239,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py index 0c3c480879b..73adff10311 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py @@ -198,6 +198,8 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -248,6 +250,8 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py index 305abeaae2d..53d1c8ff226 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py @@ -250,6 +250,8 @@ def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -300,6 +302,8 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py index 14723dee6f0..a99c87df69c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py @@ -148,6 +148,8 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -198,6 +200,8 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py index 6331d72b957..25c3954e5f9 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py @@ -187,6 +187,8 @@ def put_known_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -237,6 +239,8 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py index 62052154e18..f936e4dc1af 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py @@ -195,6 +195,8 @@ def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py index cadbd012112..85727ae6ea5 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py @@ -151,6 +151,8 @@ async def put_empty( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py index 0c24b85108e..13ce59e6225 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py @@ -356,6 +356,8 @@ def put_extensible_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -680,6 +682,8 @@ def put_fixed_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py index 262047c1928..c3726ea02f1 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py @@ -238,6 +238,8 @@ async def put_extensible_model( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -564,6 +566,8 @@ async def put_fixed_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py index 36fda74142b..7804a6fa786 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py @@ -381,6 +381,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -634,6 +636,8 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py index 4cb28db43cf..98e8f267226 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py @@ -293,6 +293,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -546,6 +548,8 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py index 9b229c7fe9f..3a5737fc501 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py @@ -203,6 +203,8 @@ def post_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py index cfb1b3eaf7c..dbbe621b16e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py @@ -159,6 +159,8 @@ async def post_valid( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py index cc58aa007ba..589740c0858 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py @@ -188,6 +188,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py index 623f14a1347..80d982085ed 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py @@ -157,6 +157,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py index 818d1bd2a41..e719368656c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py @@ -413,6 +413,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -684,6 +686,8 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py index 7a7f80a494c..2c7cde8335a 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py @@ -312,6 +312,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -583,6 +585,8 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py index 0596fb6f596..275484d9365 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py @@ -199,6 +199,8 @@ def input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py index 7b06e2c1e8a..e026e219a2e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py @@ -155,6 +155,8 @@ async def input( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py index 1430dddffc5..5a683a6b95f 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py @@ -452,6 +452,8 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -587,6 +589,8 @@ def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -721,6 +725,8 @@ def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -855,6 +861,8 @@ def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -989,6 +997,8 @@ def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py index 4fcc2c533dc..49caded1d48 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py @@ -369,6 +369,8 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -504,6 +506,8 @@ async def put_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -638,6 +642,8 @@ async def patch_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -772,6 +778,8 @@ async def post_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -906,6 +914,8 @@ async def delete_model( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py index 483fd08fa6e..2035bc02858 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py @@ -290,6 +290,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -499,6 +501,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -729,6 +733,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -925,6 +931,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1131,6 +1139,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1361,6 +1371,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1557,6 +1569,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1753,6 +1767,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1947,6 +1963,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2143,6 +2161,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2339,6 +2359,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2533,6 +2555,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2735,6 +2759,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2937,6 +2963,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3137,6 +3165,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3351,6 +3381,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3559,6 +3591,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3766,6 +3800,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3962,6 +3998,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4158,6 +4196,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4354,6 +4394,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4550,6 +4592,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4749,6 +4793,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4948,6 +4994,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5153,6 +5201,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5364,6 +5414,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5559,6 +5611,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5754,6 +5808,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5950,6 +6006,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6150,6 +6208,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6352,6 +6412,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6554,6 +6616,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py index 49535b1d9d0..456ddb4c088 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py @@ -1140,6 +1140,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1349,6 +1351,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1579,6 +1583,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1775,6 +1781,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1981,6 +1989,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2211,6 +2221,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2407,6 +2419,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2603,6 +2617,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2797,6 +2813,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2993,6 +3011,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3189,6 +3209,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3383,6 +3405,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3585,6 +3609,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3787,6 +3813,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3987,6 +4015,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4201,6 +4231,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4409,6 +4441,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4616,6 +4650,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4812,6 +4848,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5008,6 +5046,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5204,6 +5244,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5400,6 +5442,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5599,6 +5643,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5798,6 +5844,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6003,6 +6051,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6214,6 +6264,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6409,6 +6461,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6604,6 +6658,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6800,6 +6856,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7000,6 +7058,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7202,6 +7262,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -7404,6 +7466,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py index 9dffe9c1d96..da74ff4ded4 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py @@ -312,6 +312,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -432,6 +434,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -686,6 +690,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -806,6 +812,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1060,6 +1068,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1180,6 +1190,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1434,6 +1446,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1554,6 +1568,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1820,6 +1836,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1948,6 +1966,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2224,6 +2244,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2356,6 +2378,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2625,6 +2649,8 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2754,6 +2780,8 @@ async def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py index c7ba1f8dca4..49c6f045022 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py @@ -678,6 +678,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -798,6 +800,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1052,6 +1056,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1172,6 +1178,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1426,6 +1434,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1546,6 +1556,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1800,6 +1812,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1920,6 +1934,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2186,6 +2202,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2314,6 +2332,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2590,6 +2610,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2722,6 +2744,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2991,6 +3015,8 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3120,6 +3146,8 @@ def patch_null( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py index ba9be210cec..6c2b82359d0 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py @@ -336,6 +336,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -454,6 +456,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -704,6 +708,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -822,6 +828,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1072,6 +1080,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1190,6 +1200,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1440,6 +1452,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1558,6 +1572,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1816,6 +1832,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1938,6 +1956,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2206,6 +2226,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2332,6 +2354,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2582,6 +2606,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2700,6 +2726,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2950,6 +2978,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3068,6 +3098,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3318,6 +3350,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3436,6 +3470,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3686,6 +3722,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3804,6 +3842,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4057,6 +4097,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4176,6 +4218,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4426,6 +4470,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4544,6 +4590,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4797,6 +4845,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4916,6 +4966,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5173,6 +5225,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5294,6 +5348,8 @@ async def put_required_only( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py index cc898343123..020936f7301 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py @@ -1070,6 +1070,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1188,6 +1190,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1438,6 +1442,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1556,6 +1562,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1806,6 +1814,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1924,6 +1934,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2174,6 +2186,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2292,6 +2306,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2550,6 +2566,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2672,6 +2690,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2940,6 +2960,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3066,6 +3088,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3316,6 +3340,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3434,6 +3460,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3684,6 +3712,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3802,6 +3832,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4052,6 +4084,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4170,6 +4204,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4420,6 +4456,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4538,6 +4576,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4791,6 +4831,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4910,6 +4952,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5160,6 +5204,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5278,6 +5324,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5531,6 +5579,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5650,6 +5700,8 @@ def put_default( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5907,6 +5959,8 @@ def put_all( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6028,6 +6082,8 @@ def put_required_only( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py index a4fd4618c71..1ade23bc595 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py @@ -281,6 +281,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -474,6 +476,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -667,6 +671,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -860,6 +866,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1053,6 +1061,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1246,6 +1256,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1439,6 +1451,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1632,6 +1646,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1825,6 +1841,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2018,6 +2036,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2212,6 +2232,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2411,6 +2433,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2612,6 +2636,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2812,6 +2838,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3019,6 +3047,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3220,6 +3250,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3401,6 +3433,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3595,6 +3629,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3788,6 +3824,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3982,6 +4020,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4176,6 +4216,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4370,6 +4412,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4563,6 +4607,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4757,6 +4803,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4951,6 +4999,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5147,6 +5197,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5341,6 +5393,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5536,6 +5590,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5730,6 +5786,8 @@ async def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py index 7287eb3cedd..40278761b80 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py @@ -1037,6 +1037,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1230,6 +1232,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1423,6 +1427,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1616,6 +1622,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1809,6 +1817,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2002,6 +2012,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2195,6 +2207,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2388,6 +2402,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2581,6 +2597,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2774,6 +2792,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2968,6 +2988,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3167,6 +3189,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3368,6 +3392,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3568,6 +3594,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3775,6 +3803,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -3976,6 +4006,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4157,6 +4189,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4351,6 +4385,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4544,6 +4580,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4738,6 +4776,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -4932,6 +4972,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5126,6 +5168,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5319,6 +5363,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5513,6 +5559,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5707,6 +5755,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -5903,6 +5953,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6097,6 +6149,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6292,6 +6346,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -6486,6 +6542,8 @@ def put( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py index 4e45d9932ba..f93ed7cd170 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py @@ -158,6 +158,8 @@ async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -272,6 +274,8 @@ async def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=incon response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -386,6 +390,8 @@ async def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=incons response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -502,6 +508,8 @@ async def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -547,6 +555,8 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -663,6 +673,8 @@ async def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -708,6 +720,8 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -832,6 +846,8 @@ async def verify( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -956,6 +972,8 @@ async def verify( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py index a84d69d767c..1428eb42325 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py @@ -361,6 +361,8 @@ def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -475,6 +477,8 @@ def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -589,6 +593,8 @@ def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -705,6 +711,8 @@ def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -750,6 +758,8 @@ def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -866,6 +876,8 @@ def request_body( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -911,6 +923,8 @@ def request_parameter( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1033,6 +1047,8 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1155,6 +1171,8 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py index 637dffd316a..94b44f6835c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py @@ -253,6 +253,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -457,6 +459,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -665,6 +669,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -865,6 +871,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1065,6 +1073,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1271,6 +1281,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1480,6 +1492,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1689,6 +1703,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1904,6 +1920,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2158,6 +2176,8 @@ async def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py index c1265d92333..3ac9f72807e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py @@ -515,6 +515,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -719,6 +721,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -927,6 +931,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1127,6 +1133,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1327,6 +1335,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1533,6 +1543,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1742,6 +1754,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1951,6 +1965,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2166,6 +2182,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -2420,6 +2438,8 @@ def send( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response)