Client Test

Client Test

rev. b089fac03cba5061dd86d9628e74511b55f01c68 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/streaming_traits_require_length.rs

@@ -224,224 +321,325 @@
  244    244   
mod streaming_traits_require_length_test {
  245    245   
  246    246   
    /// Serializes a blob in the HTTP payload with a required length
  247    247   
    /// Test ID: RestJsonStreamingTraitsRequireLengthWithBlob
  248    248   
    #[::tokio::test]
  249    249   
    #[::tracing_test::traced_test]
  250    250   
    async fn rest_json_streaming_traits_require_length_with_blob_request() {
  251    251   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  252    252   
        let config_builder = crate::config::Config::builder()
  253    253   
            .with_test_defaults()
  254         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         254  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         255  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         256  +
            .allow_no_auth()
  255    257   
            .endpoint_url("https://example.com");
  256    258   
  257    259   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  258    260   
        let result = client
  259    261   
            .streaming_traits_require_length()
  260    262   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  261    263   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::byte_stream::ByteStream::from_static(
  262    264   
                b"blobby blob blob",
  263    265   
            )))
  264    266   
            .send()
  265    267   
            .await;
  266    268   
        let _ = dbg!(result);
  267    269   
        let http_request = request_receiver.expect_request();
  268    270   
        let expected_headers = [("Content-Type", "application/octet-stream"), ("X-Foo", "Foo")];
  269    271   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  270    272   
        let required_headers = &["Content-Length"];
  271    273   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  272    274   
        let body = http_request.body().bytes().expect("body should be strict");
  273    275   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  274    276   
            body,
  275    277   
            "blobby blob blob",
  276    278   
            ::aws_smithy_protocol_test::MediaType::from("application/octet-stream"),
  277    279   
        ));
  278    280   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  279    281   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  280    282   
        ::pretty_assertions::assert_eq!(uri.path(), "/StreamingTraitsRequireLength", "path was incorrect");
  281    283   
    }
  282    284   
  283    285   
    /// Serializes an empty blob in the HTTP payload
  284    286   
    /// Test ID: RestJsonStreamingTraitsRequireLengthWithNoBlobBody
  285    287   
    #[::tokio::test]
  286    288   
    #[::tracing_test::traced_test]
  287    289   
    async fn rest_json_streaming_traits_require_length_with_no_blob_body_request() {
  288    290   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  289    291   
        let config_builder = crate::config::Config::builder()
  290    292   
            .with_test_defaults()
  291         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         293  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         294  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         295  +
            .allow_no_auth()
  292    296   
            .endpoint_url("https://example.com");
  293    297   
  294    298   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  295    299   
        let result = client
  296    300   
            .streaming_traits_require_length()
  297    301   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  298    302   
            .send()
  299    303   
            .await;
  300    304   
        let _ = dbg!(result);
  301    305   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/streaming_traits_with_media_type.rs

@@ -237,237 +297,299 @@
  257    257   
mod streaming_traits_with_media_type_test {
  258    258   
  259    259   
    /// Serializes a blob in the HTTP payload with a content-type
  260    260   
    /// Test ID: RestJsonStreamingTraitsWithMediaTypeWithBlob
  261    261   
    #[::tokio::test]
  262    262   
    #[::tracing_test::traced_test]
  263    263   
    async fn rest_json_streaming_traits_with_media_type_with_blob_request() {
  264    264   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  265    265   
        let config_builder = crate::config::Config::builder()
  266    266   
            .with_test_defaults()
  267         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         267  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         268  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         269  +
            .allow_no_auth()
  268    270   
            .endpoint_url("https://example.com");
  269    271   
  270    272   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  271    273   
        let result = client
  272    274   
            .streaming_traits_with_media_type()
  273    275   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  274    276   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::byte_stream::ByteStream::from_static(
  275    277   
                b"blobby blob blob",
  276    278   
            )))
  277    279   
            .send()

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_body_structure.rs

@@ -223,223 +319,323 @@
  243    243   
mod test_body_structure_test {
  244    244   
  245    245   
    /// Serializes a structure
  246    246   
    /// Test ID: RestJsonTestBodyStructure
  247    247   
    #[::tokio::test]
  248    248   
    #[::tracing_test::traced_test]
  249    249   
    async fn rest_json_test_body_structure_request() {
  250    250   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  251    251   
        let config_builder = crate::config::Config::builder()
  252    252   
            .with_test_defaults()
  253         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         253  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         254  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         255  +
            .allow_no_auth()
  254    256   
            .endpoint_url("https://example.com");
  255    257   
  256    258   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  257    259   
        let result = client
  258    260   
            .test_body_structure()
  259    261   
            .set_test_config(::std::option::Option::Some(
  260    262   
                crate::types::TestConfig::builder().set_timeout(::std::option::Option::Some(10)).build(),
  261    263   
            ))
  262    264   
            .send()
  263    265   
            .await;
  264    266   
        let _ = dbg!(result);
  265    267   
        let http_request = request_receiver.expect_request();
  266    268   
        let expected_headers = [("Content-Type", "application/json")];
  267    269   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  268    270   
        let required_headers = &["Content-Length"];
  269    271   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  270    272   
        let body = http_request.body().bytes().expect("body should be strict");
  271    273   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  272    274   
            body,
  273    275   
            "{\"testConfig\":\n    {\"timeout\": 10}\n}",
  274    276   
            ::aws_smithy_protocol_test::MediaType::from("application/json"),
  275    277   
        ));
  276    278   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  277    279   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  278    280   
        ::pretty_assertions::assert_eq!(uri.path(), "/body", "path was incorrect");
  279    281   
    }
  280    282   
  281    283   
    /// Serializes an empty structure in the body
  282    284   
    /// Test ID: RestJsonHttpWithEmptyBody
  283    285   
    #[::tokio::test]
  284    286   
    #[::tracing_test::traced_test]
  285    287   
    async fn rest_json_http_with_empty_body_request() {
  286    288   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  287    289   
        let config_builder = crate::config::Config::builder()
  288    290   
            .with_test_defaults()
  289         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         291  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         292  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         293  +
            .allow_no_auth()
  290    294   
            .endpoint_url("https://example.com");
  291    295   
  292    296   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  293    297   
        let result = client.test_body_structure().send().await;
  294    298   
        let _ = dbg!(result);
  295    299   
        let http_request = request_receiver.expect_request();
  296    300   
        let expected_headers = [("Content-Type", "application/json")];
  297    301   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  298    302   
        let required_headers = &["Content-Length"];
  299    303   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_get_no_input_no_payload.rs

@@ -218,218 +278,280 @@
  238    238   
mod test_get_no_input_no_payload_test {
  239    239   
  240    240   
    /// Serializes a GET request for an operation with no input, and therefore no modeled body
  241    241   
    /// Test ID: RestJsonHttpGetWithNoInput
  242    242   
    #[::tokio::test]
  243    243   
    #[::tracing_test::traced_test]
  244    244   
    async fn rest_json_http_get_with_no_input_request() {
  245    245   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  246    246   
        let config_builder = crate::config::Config::builder()
  247    247   
            .with_test_defaults()
  248         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         248  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         249  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         250  +
            .allow_no_auth()
  249    251   
            .endpoint_url("https://example.com");
  250    252   
  251    253   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  252    254   
        let result = client.test_get_no_input_no_payload().send().await;
  253    255   
        let _ = dbg!(result);
  254    256   
        let http_request = request_receiver.expect_request();
  255    257   
        let forbidden_headers = &["Content-Type", "Content-Length"];
  256    258   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  257    259   
        let body = http_request.body().bytes().expect("body should be strict");
  258    260   
        // No body.

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_get_no_payload.rs

@@ -219,219 +304,308 @@
  239    239   
mod test_get_no_payload_test {
  240    240   
  241    241   
    /// Serializes a GET request with no modeled body
  242    242   
    /// Test ID: RestJsonHttpGetWithNoModeledBody
  243    243   
    #[::tokio::test]
  244    244   
    #[::tracing_test::traced_test]
  245    245   
    async fn rest_json_http_get_with_no_modeled_body_request() {
  246    246   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  247    247   
        let config_builder = crate::config::Config::builder()
  248    248   
            .with_test_defaults()
  249         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         249  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         250  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         251  +
            .allow_no_auth()
  250    252   
            .endpoint_url("https://example.com");
  251    253   
  252    254   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  253    255   
        let result = client.test_get_no_payload().send().await;
  254    256   
        let _ = dbg!(result);
  255    257   
        let http_request = request_receiver.expect_request();
  256    258   
        let forbidden_headers = &["Content-Length", "Content-Type"];
  257    259   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  258    260   
        let body = http_request.body().bytes().expect("body should be strict");
  259    261   
        // No body.
  260    262   
        ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
  261    263   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  262    264   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  263    265   
        ::pretty_assertions::assert_eq!(uri.path(), "/no_payload", "path was incorrect");
  264    266   
    }
  265    267   
  266    268   
    /// Serializes a GET request with header member but no modeled body
  267    269   
    /// Test ID: RestJsonHttpGetWithHeaderMemberNoModeledBody
  268    270   
    #[::tokio::test]
  269    271   
    #[::tracing_test::traced_test]
  270    272   
    async fn rest_json_http_get_with_header_member_no_modeled_body_request() {
  271    273   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  272    274   
        let config_builder = crate::config::Config::builder()
  273    275   
            .with_test_defaults()
  274         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         276  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         277  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         278  +
            .allow_no_auth()
  275    279   
            .endpoint_url("https://example.com");
  276    280   
  277    281   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  278    282   
        let result = client
  279    283   
            .test_get_no_payload()
  280    284   
            .set_test_id(::std::option::Option::Some("t-12345".to_owned()))
  281    285   
            .send()
  282    286   
            .await;
  283    287   
        let _ = dbg!(result);
  284    288   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_payload_blob.rs

@@ -223,223 +306,310 @@
  243    243   
mod test_payload_blob_test {
  244    244   
  245    245   
    /// Serializes a payload targeting an empty blob
  246    246   
    /// Test ID: RestJsonHttpWithEmptyBlobPayload
  247    247   
    #[::tokio::test]
  248    248   
    #[::tracing_test::traced_test]
  249    249   
    async fn rest_json_http_with_empty_blob_payload_request() {
  250    250   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  251    251   
        let config_builder = crate::config::Config::builder()
  252    252   
            .with_test_defaults()
  253         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         253  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         254  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         255  +
            .allow_no_auth()
  254    256   
            .endpoint_url("https://example.com");
  255    257   
  256    258   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  257    259   
        let result = client.test_payload_blob().send().await;
  258    260   
        let _ = dbg!(result);
  259    261   
        let http_request = request_receiver.expect_request();
  260    262   
        let body = http_request.body().bytes().expect("body should be strict");
  261    263   
        // No body.
  262    264   
        ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
  263    265   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  264    266   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  265    267   
        ::pretty_assertions::assert_eq!(uri.path(), "/blob_payload", "path was incorrect");
  266    268   
    }
  267    269   
  268    270   
    /// Serializes a payload targeting a blob
  269    271   
    /// Test ID: RestJsonTestPayloadBlob
  270    272   
    #[::tokio::test]
  271    273   
    #[::tracing_test::traced_test]
  272    274   
    async fn rest_json_test_payload_blob_request() {
  273    275   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  274    276   
        let config_builder = crate::config::Config::builder()
  275    277   
            .with_test_defaults()
  276         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         278  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         279  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         280  +
            .allow_no_auth()
  277    281   
            .endpoint_url("https://example.com");
  278    282   
  279    283   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  280    284   
        let result = client
  281    285   
            .test_payload_blob()
  282    286   
            .set_content_type(::std::option::Option::Some("image/jpg".to_owned()))
  283    287   
            .set_data(::std::option::Option::Some(::aws_smithy_types::Blob::new("1234")))
  284    288   
            .send()
  285    289   
            .await;
  286    290   
        let _ = dbg!(result);

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_payload_structure.rs

@@ -225,225 +355,361 @@
  245    245   
mod test_payload_structure_test {
  246    246   
  247    247   
    /// Serializes a payload targeting an empty structure
  248    248   
    /// Test ID: RestJsonHttpWithEmptyStructurePayload
  249    249   
    #[::tokio::test]
  250    250   
    #[::tracing_test::traced_test]
  251    251   
    async fn rest_json_http_with_empty_structure_payload_request() {
  252    252   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  253    253   
        let config_builder = crate::config::Config::builder()
  254    254   
            .with_test_defaults()
  255         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         255  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         256  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         257  +
            .allow_no_auth()
  256    258   
            .endpoint_url("https://example.com");
  257    259   
  258    260   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  259    261   
        let result = client
  260    262   
            .test_payload_structure()
  261    263   
            .set_payload_config(::std::option::Option::Some(crate::types::PayloadConfig::builder().build()))
  262    264   
            .send()
  263    265   
            .await;
  264    266   
        let _ = dbg!(result);
  265    267   
        let http_request = request_receiver.expect_request();
  266    268   
        let expected_headers = [("Content-Type", "application/json")];
  267    269   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  268    270   
        let required_headers = &["Content-Length"];
  269    271   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  270    272   
        let body = http_request.body().bytes().expect("body should be strict");
  271    273   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  272    274   
            body,
  273    275   
            "{}",
  274    276   
            ::aws_smithy_protocol_test::MediaType::from("application/json"),
  275    277   
        ));
  276    278   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  277    279   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  278    280   
        ::pretty_assertions::assert_eq!(uri.path(), "/payload", "path was incorrect");
  279    281   
    }
  280    282   
  281    283   
    /// Serializes a payload targeting a structure
  282    284   
    /// Test ID: RestJsonTestPayloadStructure
  283    285   
    #[::tokio::test]
  284    286   
    #[::tracing_test::traced_test]
  285    287   
    async fn rest_json_test_payload_structure_request() {
  286    288   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  287    289   
        let config_builder = crate::config::Config::builder()
  288    290   
            .with_test_defaults()
  289         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         291  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         292  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         293  +
            .allow_no_auth()
  290    294   
            .endpoint_url("https://example.com");
  291    295   
  292    296   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  293    297   
        let result = client
  294    298   
            .test_payload_structure()
  295    299   
            .set_payload_config(::std::option::Option::Some(
  296    300   
                crate::types::PayloadConfig::builder().set_data(::std::option::Option::Some(25)).build(),
  297    301   
            ))
  298    302   
            .send()
  299    303   
            .await;
  300    304   
        let _ = dbg!(result);
  301    305   
        let http_request = request_receiver.expect_request();
  302    306   
        let expected_headers = [("Content-Type", "application/json")];
  303    307   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  304    308   
        let required_headers = &["Content-Length"];
  305    309   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  306    310   
        let body = http_request.body().bytes().expect("body should be strict");
  307    311   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  308    312   
            body,
  309    313   
            "{\"data\": 25\n}",
  310    314   
            ::aws_smithy_protocol_test::MediaType::from("application/json"),
  311    315   
        ));
  312    316   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  313    317   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  314    318   
        ::pretty_assertions::assert_eq!(uri.path(), "/payload", "path was incorrect");
  315    319   
    }
  316    320   
  317    321   
    /// Serializes an request with header members but no payload
  318    322   
    /// Test ID: RestJsonHttpWithHeadersButNoPayload
  319    323   
    #[::tokio::test]
  320    324   
    #[::tracing_test::traced_test]
  321    325   
    async fn rest_json_http_with_headers_but_no_payload_request() {
  322    326   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  323    327   
        let config_builder = crate::config::Config::builder()
  324    328   
            .with_test_defaults()
  325         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         329  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         330  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         331  +
            .allow_no_auth()
  326    332   
            .endpoint_url("https://example.com");
  327    333   
  328    334   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  329    335   
        let result = client
  330    336   
            .test_payload_structure()
  331    337   
            .set_test_id(::std::option::Option::Some("t-12345".to_owned()))
  332    338   
            .set_payload_config(::std::option::Option::Some(crate::types::PayloadConfig::builder().build()))
  333    339   
            .send()
  334    340   
            .await;
  335    341   
        let _ = dbg!(result);

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_post_no_input_no_payload.rs

@@ -218,218 +278,280 @@
  238    238   
mod test_post_no_input_no_payload_test {
  239    239   
  240    240   
    /// Serializes a POST request for an operation with no input, and therefore no modeled body
  241    241   
    /// Test ID: RestJsonHttpPostWithNoInput
  242    242   
    #[::tokio::test]
  243    243   
    #[::tracing_test::traced_test]
  244    244   
    async fn rest_json_http_post_with_no_input_request() {
  245    245   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  246    246   
        let config_builder = crate::config::Config::builder()
  247    247   
            .with_test_defaults()
  248         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         248  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         249  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         250  +
            .allow_no_auth()
  249    251   
            .endpoint_url("https://example.com");
  250    252   
  251    253   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  252    254   
        let result = client.test_post_no_input_no_payload().send().await;
  253    255   
        let _ = dbg!(result);
  254    256   
        let http_request = request_receiver.expect_request();
  255    257   
        let forbidden_headers = &["Content-Type"];
  256    258   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  257    259   
        let body = http_request.body().bytes().expect("body should be strict");
  258    260   
        // No body.

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/test_post_no_payload.rs

@@ -219,219 +304,308 @@
  239    239   
mod test_post_no_payload_test {
  240    240   
  241    241   
    /// Serializes a POST request with no modeled body
  242    242   
    /// Test ID: RestJsonHttpPostWithNoModeledBody
  243    243   
    #[::tokio::test]
  244    244   
    #[::tracing_test::traced_test]
  245    245   
    async fn rest_json_http_post_with_no_modeled_body_request() {
  246    246   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  247    247   
        let config_builder = crate::config::Config::builder()
  248    248   
            .with_test_defaults()
  249         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         249  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         250  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         251  +
            .allow_no_auth()
  250    252   
            .endpoint_url("https://example.com");
  251    253   
  252    254   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  253    255   
        let result = client.test_post_no_payload().send().await;
  254    256   
        let _ = dbg!(result);
  255    257   
        let http_request = request_receiver.expect_request();
  256    258   
        let forbidden_headers = &["Content-Type"];
  257    259   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  258    260   
        let body = http_request.body().bytes().expect("body should be strict");
  259    261   
        // No body.
  260    262   
        ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
  261    263   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  262    264   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  263    265   
        ::pretty_assertions::assert_eq!(uri.path(), "/no_payload", "path was incorrect");
  264    266   
    }
  265    267   
  266    268   
    /// Serializes a POST request with header member but no modeled body
  267    269   
    /// Test ID: RestJsonHttpWithPostHeaderMemberNoModeledBody
  268    270   
    #[::tokio::test]
  269    271   
    #[::tracing_test::traced_test]
  270    272   
    async fn rest_json_http_with_post_header_member_no_modeled_body_request() {
  271    273   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  272    274   
        let config_builder = crate::config::Config::builder()
  273    275   
            .with_test_defaults()
  274         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         276  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         277  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         278  +
            .allow_no_auth()
  275    279   
            .endpoint_url("https://example.com");
  276    280   
  277    281   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  278    282   
        let result = client
  279    283   
            .test_post_no_payload()
  280    284   
            .set_test_id(::std::option::Option::Some("t-12345".to_owned()))
  281    285   
            .send()
  282    286   
            .await;
  283    287   
        let _ = dbg!(result);
  284    288   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/timestamp_format_headers.rs

@@ -219,219 +279,281 @@
  239    239   
mod timestamp_format_headers_test {
  240    240   
  241    241   
    /// Tests how timestamp request headers are serialized
  242    242   
    /// Test ID: RestJsonTimestampFormatHeaders
  243    243   
    #[::tokio::test]
  244    244   
    #[::tracing_test::traced_test]
  245    245   
    async fn rest_json_timestamp_format_headers_request() {
  246    246   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  247    247   
        let config_builder = crate::config::Config::builder()
  248    248   
            .with_test_defaults()
  249         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         249  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         250  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         251  +
            .allow_no_auth()
  250    252   
            .endpoint_url("https://example.com");
  251    253   
  252    254   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  253    255   
        let result = client
  254    256   
            .timestamp_format_headers()
  255    257   
            .set_member_epoch_seconds(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  256    258   
                1576540098, 0_f64,
  257    259   
            )))
  258    260   
            .set_member_http_date(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  259    261   
                1576540098, 0_f64,

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/unit_input_and_output.rs

@@ -220,220 +280,282 @@
  240    240   
    /// A unit type input serializes no payload. When clients do not
  241    241   
    /// need to serialize any data in the payload, they should omit
  242    242   
    /// a payload altogether.
  243    243   
    /// Test ID: RestJsonUnitInputAndOutput
  244    244   
    #[::tokio::test]
  245    245   
    #[::tracing_test::traced_test]
  246    246   
    async fn rest_json_unit_input_and_output_request() {
  247    247   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  248    248   
        let config_builder = crate::config::Config::builder()
  249    249   
            .with_test_defaults()
  250         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         250  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         251  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         252  +
            .allow_no_auth()
  251    253   
            .endpoint_url("https://example.com");
  252    254   
  253    255   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  254    256   
        let result = client.unit_input_and_output().send().await;
  255    257   
        let _ = dbg!(result);
  256    258   
        let http_request = request_receiver.expect_request();
  257    259   
        let body = http_request.body().bytes().expect("body should be strict");
  258    260   
        // No body.
  259    261   
        ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
  260    262   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/config.rs

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1198,1216 +1257,1276 @@
 1218   1236   
    {
 1219   1237   
        if config.behavior_version.is_none() {
 1220   1238   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1221   1239   
        }
 1222   1240   
    }
 1223   1241   
 1224   1242   
    let default_retry_partition = "restjsonprotocol";
 1225   1243   
 1226   1244   
    let scope = "rest_json_extras";
 1227   1245   
        1246  +
    #[allow(deprecated)]
 1228   1247   
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1229   1248   
                        // defaults
 1230   1249   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1231   1250   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1232   1251   
                                .with_retry_partition_name(default_retry_partition)
 1233   1252   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1234   1253   
                        ))
 1235   1254   
                        // user config
 1236   1255   
                        .with_client_plugin(
 1237   1256   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/config/auth.rs

@@ -73,73 +150,132 @@
   93     93   
    pub fn builder() -> crate::config::auth::ParamsBuilder {
   94     94   
        crate::config::auth::ParamsBuilder::default()
   95     95   
    }
   96     96   
   97     97   
    /// Return the operation name for [`Params`]
   98     98   
    pub fn operation_name(&self) -> &str {
   99     99   
        self.operation_name.as_ref()
  100    100   
    }
  101    101   
}
  102    102   
  103         -
#[cfg(test)]
  104         -
#[derive(Debug)]
  105         -
pub(crate) struct NoAuthSchemeResolver;
  106         -
  107         -
#[cfg(test)]
  108         -
impl ResolveAuthScheme for NoAuthSchemeResolver {
  109         -
    fn resolve_auth_scheme<'a>(
  110         -
        &'a self,
  111         -
        _params: &'a crate::config::auth::Params,
  112         -
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
  113         -
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
  114         -
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  115         -
        ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(::std::result::Result::Ok(vec![
  116         -
            ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID),
  117         -
        ]))
  118         -
    }
  119         -
}
  120         -
  121    103   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  122    104   
/// Builder for [`Params`]
  123    105   
pub struct ParamsBuilder {
  124    106   
    operation_name: ::std::option::Option<::std::borrow::Cow<'static, str>>,
  125    107   
}
  126    108   
impl ParamsBuilder {
  127    109   
    /// Set the operation name for the builder
  128    110   
    pub fn operation_name(self, operation_name: impl Into<::std::borrow::Cow<'static, str>>) -> Self {
  129    111   
        self.set_operation_name(::std::option::Option::Some(operation_name.into()))
  130    112   
    }

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/enum_query.rs

@@ -220,220 +280,282 @@
  240    240   
#[cfg(test)]
  241    241   
mod enum_query_test {
  242    242   
  243    243   
    /// Test ID: EnumQueryRequest
  244    244   
    #[::tokio::test]
  245    245   
    #[::tracing_test::traced_test]
  246    246   
    async fn enum_query_request_request() {
  247    247   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  248    248   
        let config_builder = crate::config::Config::builder()
  249    249   
            .with_test_defaults()
  250         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         250  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         251  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         252  +
            .allow_no_auth()
  251    253   
            .endpoint_url("https://example.com");
  252    254   
  253    255   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  254    256   
        let result = client
  255    257   
            .enum_query()
  256    258   
            .set_enum(::std::option::Option::Some(
  257    259   
                "enumvalue".parse::<crate::types::StringEnum>().expect("static value validated to member"),
  258    260   
            ))
  259    261   
            .send()
  260    262   
            .await;

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/escaped_string_values.rs

@@ -223,223 +283,285 @@
  243    243   
#[cfg(test)]
  244    244   
mod escaped_string_values_test {
  245    245   
  246    246   
    /// Test ID: EscapedStringValuesRequest
  247    247   
    #[::tokio::test]
  248    248   
    #[::tracing_test::traced_test]
  249    249   
    async fn escaped_string_values_request_request() {
  250    250   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  251    251   
        let config_builder = crate::config::Config::builder()
  252    252   
            .with_test_defaults()
  253         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         253  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         254  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         255  +
            .allow_no_auth()
  254    256   
            .endpoint_url("https://example.com");
  255    257   
  256    258   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  257    259   
        let result = client
  258    260   
            .escaped_string_values()
  259    261   
            .set_enum(::std::option::Option::Some(
  260    262   
                "has\"quotes"
  261    263   
                    .parse::<crate::types::EnumWithEscapedChars>()
  262    264   
                    .expect("static value validated to member"),
  263    265   
            ))

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/http_query_params_only_operation.rs

@@ -236,236 +327,331 @@
  256    256   
mod http_query_params_only_operation_test {
  257    257   
  258    258   
    /// Test that httpQueryParams are included in request when no other query parameters exist
  259    259   
    /// Test ID: HttpQueryParamsOnlyRequest
  260    260   
    #[::tokio::test]
  261    261   
    #[::tracing_test::traced_test]
  262    262   
    async fn http_query_params_only_request_request() {
  263    263   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  264    264   
        let config_builder = crate::config::Config::builder()
  265    265   
            .with_test_defaults()
  266         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         266  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         267  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         268  +
            .allow_no_auth()
  267    269   
            .endpoint_url("https://example.com");
  268    270   
  269    271   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  270    272   
        let result = client
  271    273   
            .http_query_params_only_operation()
  272    274   
            .set_query_map(::std::option::Option::Some({
  273    275   
                let mut ret = ::std::collections::HashMap::new();
  274    276   
                ret.insert("shouldExpandRoles".to_owned(), "true".to_owned());
  275    277   
                ret.insert("shouldShowOnlyAuthForThisDocument".to_owned(), "false".to_owned());
  276    278   
                ret
  277    279   
            }))
  278    280   
            .send()
  279    281   
            .await;
  280    282   
        let _ = dbg!(result);
  281    283   
        let http_request = request_receiver.expect_request();
  282    284   
        let expected_query_params = &["shouldExpandRoles=true", "shouldShowOnlyAuthForThisDocument=false"];
  283    285   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_query_string(&http_request, expected_query_params));
  284    286   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  285    287   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  286    288   
        ::pretty_assertions::assert_eq!(uri.path(), "/http-query-params-only", "path was incorrect");
  287    289   
    }
  288    290   
  289    291   
    /// Test that empty httpQueryParams map results in no query parameters
  290    292   
    /// Test ID: HttpQueryParamsOnlyEmptyRequest
  291    293   
    #[::tokio::test]
  292    294   
    #[::tracing_test::traced_test]
  293    295   
    async fn http_query_params_only_empty_request_request() {
  294    296   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  295    297   
        let config_builder = crate::config::Config::builder()
  296    298   
            .with_test_defaults()
  297         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         299  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         300  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         301  +
            .allow_no_auth()
  298    302   
            .endpoint_url("https://example.com");
  299    303   
  300    304   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  301    305   
        let result = client
  302    306   
            .http_query_params_only_operation()
  303    307   
            .set_query_map(::std::option::Option::Some(::std::collections::HashMap::new()))
  304    308   
            .send()
  305    309   
            .await;
  306    310   
        let _ = dbg!(result);
  307    311   
        let http_request = request_receiver.expect_request();