Client Test

Client Test

rev. a7fb2e3446d314cfbe48069306e4e0a389b39aeb (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/float16.rs

@@ -139,139 +200,198 @@
  159    159   
                input: &crate::operation::float16::Float16Input,
  160    160   
                builder: ::http::request::Builder,
  161    161   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  162    162   
                let mut uri = ::std::string::String::new();
  163    163   
                uri_base(input, &mut uri)?;
  164    164   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  165    165   
            }
  166    166   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  167    167   
            builder =
  168    168   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  169         -
            builder =
  170         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  171    169   
            builder
  172    170   
        };
  173    171   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  174    172   
        if let Some(content_length) = body.content_length() {
  175    173   
            let content_length = content_length.to_string();
  176    174   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  177    175   
        }
  178    176   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  179    177   
    }
  180    178   
}

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/fractional_seconds.rs

@@ -149,149 +210,208 @@
  169    169   
                input: &crate::operation::fractional_seconds::FractionalSecondsInput,
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder =
  178    178   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  179         -
            builder =
  180         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  181    179   
            builder
  182    180   
        };
  183    181   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  184    182   
        if let Some(content_length) = body.content_length() {
  185    183   
            let content_length = content_length.to_string();
  186    184   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  187    185   
        }
  188    186   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  189    187   
    }
  190    188   
}

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/greeting_with_errors.rs

@@ -149,149 +210,208 @@
  169    169   
                input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder =
  178    178   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  179         -
            builder =
  180         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  181    179   
            builder
  182    180   
        };
  183    181   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  184    182   
        if let Some(content_length) = body.content_length() {
  185    183   
            let content_length = content_length.to_string();
  186    184   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  187    185   
        }
  188    186   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  189    187   
    }
  190    188   
}

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/no_input_output.rs

@@ -148,148 +209,207 @@
  168    168   
                input: &crate::operation::no_input_output::NoInputOutputInput,
  169    169   
                builder: ::http::request::Builder,
  170    170   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  171    171   
                let mut uri = ::std::string::String::new();
  172    172   
                uri_base(input, &mut uri)?;
  173    173   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  174    174   
            }
  175    175   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  176    176   
            builder =
  177    177   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  178         -
            builder =
  179         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  180    178   
            builder
  181    179   
        };
  182    180   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  183    181   
        if let Some(content_length) = body.content_length() {
  184    182   
            let content_length = content_length.to_string();
  185    183   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  186    184   
        }
  187    185   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  188    186   
    }
  189    187   
}
@@ -211,209 +271,269 @@
  231    229   
    #[::tokio::test]
  232    230   
    #[::tracing_test::traced_test]
  233    231   
    async fn no_input_request() {
  234    232   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  235    233   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  236    234   
  237    235   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  238    236   
        let result = client.no_input_output().send().await;
  239    237   
        let _ = dbg!(result);
  240    238   
        let http_request = request_receiver.expect_request();
  241         -
        let expected_headers = [("Accept", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
         239  +
        let expected_headers = [("smithy-protocol", "rpc-v2-cbor")];
  242    240   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  243    241   
        let forbidden_headers = &["Content-Type", "X-Amz-Target"];
  244    242   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  245    243   
        let body = http_request.body().bytes().expect("body should be strict");
  246    244   
        // No body.
  247    245   
        ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
  248    246   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  249    247   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  250    248   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/NoInputOutput", "path was incorrect");
  251    249   
    }

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/operation_with_defaults.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation_with_defaults::ser_operation_with_defaults_input(
  191    189   
            &input,
  192    190   
        )?);
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -227,225 +320,310 @@
  247    245   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  248    246   
  249    247   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  250    248   
        let result = client
  251    249   
            .operation_with_defaults()
  252    250   
            .set_defaults(::std::option::Option::Some(crate::types::Defaults::builder().build()))
  253    251   
            .send()
  254    252   
            .await;
  255    253   
        let _ = dbg!(result);
  256    254   
        let http_request = request_receiver.expect_request();
  257         -
        let expected_headers = [
  258         -
            ("Accept", "application/cbor"),
  259         -
            ("Content-Type", "application/cbor"),
  260         -
            ("smithy-protocol", "rpc-v2-cbor"),
  261         -
        ];
         255  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  262    256   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  263    257   
        let required_headers = &["Content-Length"];
  264    258   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  265    259   
        let body = http_request.body().bytes().expect("body should be strict");
  266    260   
        ::aws_smithy_protocol_test::assert_ok(
  267    261   
        ::aws_smithy_protocol_test::validate_body(body, "v2hkZWZhdWx0c79tZGVmYXVsdFN0cmluZ2JoaW5kZWZhdWx0Qm9vbGVhbvVrZGVmYXVsdExpc3Sf/3BkZWZhdWx0VGltZXN0YW1wwQBrZGVmYXVsdEJsb2JjYWJja2RlZmF1bHRCeXRlAWxkZWZhdWx0U2hvcnQBbmRlZmF1bHRJbnRlZ2VyCmtkZWZhdWx0TG9uZxhkbGRlZmF1bHRGbG9hdPo/gAAAbWRlZmF1bHREb3VibGX6P4AAAGpkZWZhdWx0TWFwv/9rZGVmYXVsdEVudW1jRk9PbmRlZmF1bHRJbnRFbnVtAWtlbXB0eVN0cmluZ2BsZmFsc2VCb29sZWFu9GllbXB0eUJsb2JgaHplcm9CeXRlAGl6ZXJvU2hvcnQAa3plcm9JbnRlZ2VyAGh6ZXJvTG9uZwBpemVyb0Zsb2F0+gAAAABqemVyb0RvdWJsZfoAAAAA//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  268    262   
        );
  269    263   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  270    264   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  271    265   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  272    266   
    }
  273    267   
  274    268   
    /// Client skips top level default values in input.
  275    269   
    /// Test ID: RpcV2CborClientSkipsTopLevelDefaultValuesInInput
  276    270   
    #[::tokio::test]
  277    271   
    #[::tracing_test::traced_test]
  278    272   
    async fn rpc_v2_cbor_client_skips_top_level_default_values_in_input_request() {
  279    273   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  280    274   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  281    275   
  282    276   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  283    277   
        let result = client.operation_with_defaults().send().await;
  284    278   
        let _ = dbg!(result);
  285    279   
        let http_request = request_receiver.expect_request();
  286         -
        let expected_headers = [
  287         -
            ("Accept", "application/cbor"),
  288         -
            ("Content-Type", "application/cbor"),
  289         -
            ("smithy-protocol", "rpc-v2-cbor"),
  290         -
        ];
         280  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  291    281   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  292    282   
        let required_headers = &["Content-Length"];
  293    283   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  294    284   
        let body = http_request.body().bytes().expect("body should be strict");
  295    285   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  296    286   
            body,
  297    287   
            "v/8=",
  298    288   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  299    289   
        ));
  300    290   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
@@ -324,314 +457,435 @@
  344    334   
                    .set_zero_integer(::std::option::Option::Some(1))
  345    335   
                    .set_zero_long(::std::option::Option::Some(1))
  346    336   
                    .set_zero_float(::std::option::Option::Some(1.0_f32))
  347    337   
                    .set_zero_double(::std::option::Option::Some(1.0_f64))
  348    338   
                    .build(),
  349    339   
            ))
  350    340   
            .send()
  351    341   
            .await;
  352    342   
        let _ = dbg!(result);
  353    343   
        let http_request = request_receiver.expect_request();
  354         -
        let expected_headers = [
  355         -
            ("Accept", "application/cbor"),
  356         -
            ("Content-Type", "application/cbor"),
  357         -
            ("smithy-protocol", "rpc-v2-cbor"),
  358         -
        ];
         344  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  359    345   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  360    346   
        let required_headers = &["Content-Length"];
  361    347   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  362    348   
        let body = http_request.body().bytes().expect("body should be strict");
  363    349   
        ::aws_smithy_protocol_test::assert_ok(
  364    350   
        ::aws_smithy_protocol_test::validate_body(body, "v2hkZWZhdWx0c7dtZGVmYXVsdFN0cmluZ2NieWVuZGVmYXVsdEJvb2xlYW71a2RlZmF1bHRMaXN0gWFhcGRlZmF1bHRUaW1lc3RhbXDB+z/wAAAAAAAAa2RlZmF1bHRCbG9iQmhpa2RlZmF1bHRCeXRlAmxkZWZhdWx0U2hvcnQCbmRlZmF1bHRJbnRlZ2VyFGtkZWZhdWx0TG9uZxjIbGRlZmF1bHRGbG9hdPpAAAAAbWRlZmF1bHREb3VibGX7QAAAAAAAAABqZGVmYXVsdE1hcKFkbmFtZWRKYWNra2RlZmF1bHRFbnVtY0JBUm5kZWZhdWx0SW50RW51bQJrZW1wdHlTdHJpbmdjZm9vbGZhbHNlQm9vbGVhbvVpZW1wdHlCbG9iQmhpaHplcm9CeXRlAWl6ZXJvU2hvcnQBa3plcm9JbnRlZ2VyAWh6ZXJvTG9uZwFpemVyb0Zsb2F0+j+AAABqemVyb0RvdWJsZfs/8AAAAAAAAP8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  365    351   
        );
  366    352   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  367    353   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  368    354   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  369    355   
    }
  370    356   
  371    357   
    /// Any time a value is provided for a member in the top level of input, it is used, regardless of if its the default.
  372    358   
    /// Test ID: RpcV2CborClientUsesExplicitlyProvidedValuesInTopLevel
  373    359   
    #[::tokio::test]
  374    360   
    #[::tracing_test::traced_test]
  375    361   
    async fn rpc_v2_cbor_client_uses_explicitly_provided_values_in_top_level_request() {
  376    362   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  377    363   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  378    364   
  379    365   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  380    366   
        let result = client
  381    367   
            .operation_with_defaults()
  382    368   
            .set_top_level_default(::std::option::Option::Some("hi".to_owned()))
  383    369   
            .set_other_top_level_default(::std::option::Option::Some(0))
  384    370   
            .send()
  385    371   
            .await;
  386    372   
        let _ = dbg!(result);
  387    373   
        let http_request = request_receiver.expect_request();
  388         -
        let expected_headers = [
  389         -
            ("Accept", "application/cbor"),
  390         -
            ("Content-Type", "application/cbor"),
  391         -
            ("smithy-protocol", "rpc-v2-cbor"),
  392         -
        ];
         374  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  393    375   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  394    376   
        let required_headers = &["Content-Length"];
  395    377   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  396    378   
        let body = http_request.body().bytes().expect("body should be strict");
  397    379   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  398    380   
            body,
  399    381   
            "v290b3BMZXZlbERlZmF1bHRiaGl0b3RoZXJUb3BMZXZlbERlZmF1bHQA/w==",
  400    382   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  401    383   
        ));
  402    384   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  403    385   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  404    386   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  405    387   
    }
  406    388   
  407    389   
    /// Typically, non top-level members would have defaults filled in, but if they have the clientOptional trait, the defaults should be ignored.
  408    390   
    /// Test ID: RpcV2CborClientIgnoresNonTopLevelDefaultsOnMembersWithClientOptional
  409    391   
    #[::tokio::test]
  410    392   
    #[::tracing_test::traced_test]
  411    393   
    async fn rpc_v2_cbor_client_ignores_non_top_level_defaults_on_members_with_client_optional_request() {
  412    394   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  413    395   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  414    396   
  415    397   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  416    398   
        let result = client
  417    399   
            .operation_with_defaults()
  418    400   
            .set_client_optional_defaults(::std::option::Option::Some(crate::types::ClientOptionalDefaults::builder().build()))
  419    401   
            .send()
  420    402   
            .await;
  421    403   
        let _ = dbg!(result);
  422    404   
        let http_request = request_receiver.expect_request();
  423         -
        let expected_headers = [
  424         -
            ("Accept", "application/cbor"),
  425         -
            ("Content-Type", "application/cbor"),
  426         -
            ("smithy-protocol", "rpc-v2-cbor"),
  427         -
        ];
         405  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  428    406   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  429    407   
        let required_headers = &["Content-Length"];
  430    408   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  431    409   
        let body = http_request.body().bytes().expect("body should be strict");
  432    410   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  433    411   
            body,
  434    412   
            "v3ZjbGllbnRPcHRpb25hbERlZmF1bHRzoP8=",
  435    413   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  436    414   
        ));
  437    415   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/optional_input_output.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_optional_input_output::ser_optional_input_output_input(
  185    183   
            &input,
  186    184   
        )?);
  187    185   
        if let Some(content_length) = body.content_length() {
  188    186   
            let content_length = content_length.to_string();
  189    187   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  190    188   
        }
  191    189   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -215,213 +279,273 @@
  235    233   
    #[::tokio::test]
  236    234   
    #[::tracing_test::traced_test]
  237    235   
    async fn optional_input_request() {
  238    236   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  239    237   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  240    238   
  241    239   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  242    240   
        let result = client.optional_input_output().send().await;
  243    241   
        let _ = dbg!(result);
  244    242   
        let http_request = request_receiver.expect_request();
  245         -
        let expected_headers = [
  246         -
            ("Accept", "application/cbor"),
  247         -
            ("Content-Type", "application/cbor"),
  248         -
            ("smithy-protocol", "rpc-v2-cbor"),
  249         -
        ];
         243  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  250    244   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  251    245   
        let forbidden_headers = &["X-Amz-Target"];
  252    246   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  253    247   
        let body = http_request.body().bytes().expect("body should be strict");
  254    248   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  255    249   
            body,
  256    250   
            "v/8=",
  257    251   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  258    252   
        ));
  259    253   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/recursive_shapes.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_recursive_shapes::ser_recursive_shapes_input(&input)?);
  185    183   
        if let Some(content_length) = body.content_length() {
  186    184   
            let content_length = content_length.to_string();
  187    185   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  188    186   
        }
  189    187   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  190    188   
    }
  191    189   
}
@@ -236,234 +300,294 @@
  256    254   
                                    .build(),
  257    255   
                            ))
  258    256   
                            .build(),
  259    257   
                    )))
  260    258   
                    .build(),
  261    259   
            ))
  262    260   
            .send()
  263    261   
            .await;
  264    262   
        let _ = dbg!(result);
  265    263   
        let http_request = request_receiver.expect_request();
  266         -
        let expected_headers = [
  267         -
            ("Accept", "application/cbor"),
  268         -
            ("Content-Type", "application/cbor"),
  269         -
            ("smithy-protocol", "rpc-v2-cbor"),
  270         -
        ];
         264  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  271    265   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  272    266   
        let required_headers = &["Content-Length"];
  273    267   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  274    268   
        let body = http_request.body().bytes().expect("body should be strict");
  275    269   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  276    270   
            body,
  277    271   
            "v2ZuZXN0ZWS/Y2Zvb2RGb28xZm5lc3RlZL9jYmFyZEJhcjFvcmVjdXJzaXZlTWVtYmVyv2Nmb29kRm9vMmZuZXN0ZWS/Y2JhcmRCYXIy//////8=",
  278    272   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  279    273   
        ));
  280    274   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_dense_maps.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_rpc_v2_cbor_dense_maps::ser_rpc_v2_cbor_dense_maps_input(
  185    183   
            &input,
  186    184   
        )?);
  187    185   
        if let Some(content_length) = body.content_length() {
  188    186   
            let content_length = content_length.to_string();
  189    187   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  190    188   
        }
  191    189   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -234,232 +382,368 @@
  254    252   
                    crate::types::GreetingStruct::builder()
  255    253   
                        .set_hi(::std::option::Option::Some("bye".to_owned()))
  256    254   
                        .build(),
  257    255   
                );
  258    256   
                ret
  259    257   
            }))
  260    258   
            .send()
  261    259   
            .await;
  262    260   
        let _ = dbg!(result);
  263    261   
        let http_request = request_receiver.expect_request();
  264         -
        let expected_headers = [
  265         -
            ("Accept", "application/cbor"),
  266         -
            ("Content-Type", "application/cbor"),
  267         -
            ("smithy-protocol", "rpc-v2-cbor"),
  268         -
        ];
         262  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  269    263   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  270    264   
        let required_headers = &["Content-Length"];
  271    265   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  272    266   
        let body = http_request.body().bytes().expect("body should be strict");
  273    267   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  274    268   
            body,
  275    269   
            "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==",
  276    270   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  277    271   
        ));
  278    272   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  279    273   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  280    274   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps", "path was incorrect");
  281    275   
    }
  282    276   
  283    277   
    /// Ensure that 0 and false are sent over the wire in all maps and lists
  284    278   
    /// Test ID: RpcV2CborSerializesZeroValuesInMaps
  285    279   
    #[::tokio::test]
  286    280   
    #[::tracing_test::traced_test]
  287    281   
    async fn rpc_v2_cbor_serializes_zero_values_in_maps_request() {
  288    282   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  289    283   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  290    284   
  291    285   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  292    286   
        let result = client
  293    287   
            .rpc_v2_cbor_dense_maps()
  294    288   
            .set_dense_number_map(::std::option::Option::Some({
  295    289   
                let mut ret = ::std::collections::HashMap::new();
  296    290   
                ret.insert("x".to_owned(), 0);
  297    291   
                ret
  298    292   
            }))
  299    293   
            .set_dense_boolean_map(::std::option::Option::Some({
  300    294   
                let mut ret = ::std::collections::HashMap::new();
  301    295   
                ret.insert("x".to_owned(), false);
  302    296   
                ret
  303    297   
            }))
  304    298   
            .send()
  305    299   
            .await;
  306    300   
        let _ = dbg!(result);
  307    301   
        let http_request = request_receiver.expect_request();
  308         -
        let expected_headers = [
  309         -
            ("Accept", "application/cbor"),
  310         -
            ("Content-Type", "application/cbor"),
  311         -
            ("smithy-protocol", "rpc-v2-cbor"),
  312         -
        ];
         302  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  313    303   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  314    304   
        let required_headers = &["Content-Length"];
  315    305   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  316    306   
        let body = http_request.body().bytes().expect("body should be strict");
  317    307   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  318    308   
            body,
  319    309   
            "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==",
  320    310   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  321    311   
        ));
  322    312   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  323    313   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  324    314   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps", "path was incorrect");
  325    315   
    }
  326    316   
  327    317   
    /// A request that contains a dense map of sets.
  328    318   
    /// Test ID: RpcV2CborSerializesDenseSetMap
  329    319   
    #[::tokio::test]
  330    320   
    #[::tracing_test::traced_test]
  331    321   
    async fn rpc_v2_cbor_serializes_dense_set_map_request() {
  332    322   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  333    323   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  334    324   
  335    325   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  336    326   
        let result = client
  337    327   
            .rpc_v2_cbor_dense_maps()
  338    328   
            .set_dense_set_map(::std::option::Option::Some({
  339    329   
                let mut ret = ::std::collections::HashMap::new();
  340    330   
                ret.insert("x".to_owned(), vec![]);
  341    331   
                ret.insert("y".to_owned(), vec!["a".to_owned(), "b".to_owned()]);
  342    332   
                ret
  343    333   
            }))
  344    334   
            .send()
  345    335   
            .await;
  346    336   
        let _ = dbg!(result);
  347    337   
        let http_request = request_receiver.expect_request();
  348         -
        let expected_headers = [
  349         -
            ("Accept", "application/cbor"),
  350         -
            ("Content-Type", "application/cbor"),
  351         -
            ("smithy-protocol", "rpc-v2-cbor"),
  352         -
        ];
         338  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  353    339   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  354    340   
        let required_headers = &["Content-Length"];
  355    341   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  356    342   
        let body = http_request.body().bytes().expect("body should be strict");
  357    343   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  358    344   
            body,
  359    345   
            "oWtkZW5zZVNldE1hcKJheIBheYJhYWFi",
  360    346   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  361    347   
        ));
  362    348   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_lists.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_rpc_v2_cbor_lists::ser_rpc_v2_cbor_lists_input(&input)?);
  185    183   
        if let Some(content_length) = body.content_length() {
  186    184   
            let content_length = content_length.to_string();
  187    185   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  188    186   
        }
  189    187   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  190    188   
    }
  191    189   
}
@@ -247,245 +379,365 @@
  267    265   
                    .build(),
  268    266   
            ]))
  269    267   
            .set_blob_list(::std::option::Option::Some(vec![
  270    268   
                ::aws_smithy_types::Blob::new("foo"),
  271    269   
                ::aws_smithy_types::Blob::new("bar"),
  272    270   
            ]))
  273    271   
            .send()
  274    272   
            .await;
  275    273   
        let _ = dbg!(result);
  276    274   
        let http_request = request_receiver.expect_request();
  277         -
        let expected_headers = [
  278         -
            ("Accept", "application/cbor"),
  279         -
            ("Content-Type", "application/cbor"),
  280         -
            ("smithy-protocol", "rpc-v2-cbor"),
  281         -
        ];
         275  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  282    276   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  283    277   
        let required_headers = &["Content-Length"];
  284    278   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  285    279   
        let body = http_request.body().bytes().expect("body should be strict");
  286    280   
        ::aws_smithy_protocol_test::assert_ok(
  287    281   
        ::aws_smithy_protocol_test::validate_body(body, "v2pzdHJpbmdMaXN0gmNmb29jYmFyaXN0cmluZ1NldIJjZm9vY2JhcmtpbnRlZ2VyTGlzdIIBAmtib29sZWFuTGlzdIL19G10aW1lc3RhbXBMaXN0gsH7QdTX+/OAAADB+0HU1/vzgAAAaGVudW1MaXN0gmNGb29hMGtpbnRFbnVtTGlzdIIBAnBuZXN0ZWRTdHJpbmdMaXN0goJjZm9vY2JhcoJjYmF6Y3F1eG1zdHJ1Y3R1cmVMaXN0gqJhYWExYWJhMqJhYWEzYWJhNGhibG9iTGlzdIJDZm9vQ2Jhcv8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  288    282   
        );
  289    283   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  290    284   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  291    285   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborLists", "path was incorrect");
  292    286   
    }
  293    287   
  294    288   
    /// Serializes empty JSON lists
  295    289   
    /// Test ID: RpcV2CborListsEmpty
  296    290   
    #[::tokio::test]
  297    291   
    #[::tracing_test::traced_test]
  298    292   
    async fn rpc_v2_cbor_lists_empty_request() {
  299    293   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  300    294   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  301    295   
  302    296   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  303    297   
        let result = client
  304    298   
            .rpc_v2_cbor_lists()
  305    299   
            .set_string_list(::std::option::Option::Some(vec![]))
  306    300   
            .send()
  307    301   
            .await;
  308    302   
        let _ = dbg!(result);
  309    303   
        let http_request = request_receiver.expect_request();
  310         -
        let expected_headers = [
  311         -
            ("Accept", "application/cbor"),
  312         -
            ("Content-Type", "application/cbor"),
  313         -
            ("smithy-protocol", "rpc-v2-cbor"),
  314         -
        ];
         304  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  315    305   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  316    306   
        let required_headers = &["Content-Length"];
  317    307   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  318    308   
        let body = http_request.body().bytes().expect("body should be strict");
  319    309   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  320    310   
            body,
  321    311   
            "v2pzdHJpbmdMaXN0n///",
  322    312   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  323    313   
        ));
  324    314   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  325    315   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  326    316   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborLists", "path was incorrect");
  327    317   
    }
  328    318   
  329    319   
    /// Serializes empty JSON definite length lists
  330    320   
    /// Test ID: RpcV2CborListsEmptyUsingDefiniteLength
  331    321   
    #[::tokio::test]
  332    322   
    #[::tracing_test::traced_test]
  333    323   
    async fn rpc_v2_cbor_lists_empty_using_definite_length_request() {
  334    324   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  335    325   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  336    326   
  337    327   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  338    328   
        let result = client
  339    329   
            .rpc_v2_cbor_lists()
  340    330   
            .set_string_list(::std::option::Option::Some(vec![]))
  341    331   
            .send()
  342    332   
            .await;
  343    333   
        let _ = dbg!(result);
  344    334   
        let http_request = request_receiver.expect_request();
  345         -
        let expected_headers = [
  346         -
            ("Accept", "application/cbor"),
  347         -
            ("Content-Type", "application/cbor"),
  348         -
            ("smithy-protocol", "rpc-v2-cbor"),
  349         -
        ];
         335  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  350    336   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  351    337   
        let required_headers = &["Content-Length"];
  352    338   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  353    339   
        let body = http_request.body().bytes().expect("body should be strict");
  354    340   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  355    341   
            body,
  356    342   
            "oWpzdHJpbmdMaXN0gA==",
  357    343   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  358    344   
        ));
  359    345   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_sparse_maps.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_rpc_v2_cbor_sparse_maps::ser_rpc_v2_cbor_sparse_maps_input(
  185    183   
            &input,
  186    184   
        )?);
  187    185   
        if let Some(content_length) = body.content_length() {
  188    186   
            let content_length = content_length.to_string();
  189    187   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  190    188   
        }
  191    189   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -238,236 +481,459 @@
  258    256   
                            .set_hi(::std::option::Option::Some("bye".to_owned()))
  259    257   
                            .build(),
  260    258   
                    ),
  261    259   
                );
  262    260   
                ret
  263    261   
            }))
  264    262   
            .send()
  265    263   
            .await;
  266    264   
        let _ = dbg!(result);
  267    265   
        let http_request = request_receiver.expect_request();
  268         -
        let expected_headers = [
  269         -
            ("Accept", "application/cbor"),
  270         -
            ("Content-Type", "application/cbor"),
  271         -
            ("smithy-protocol", "rpc-v2-cbor"),
  272         -
        ];
         266  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  273    267   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  274    268   
        let required_headers = &["Content-Length"];
  275    269   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  276    270   
        let body = http_request.body().bytes().expect("body should be strict");
  277    271   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  278    272   
            body,
  279    273   
            "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////",
  280    274   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  281    275   
        ));
  282    276   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  283    277   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  284    278   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  285    279   
    }
  286    280   
  287    281   
    /// Serializes null map values in sparse maps
  288    282   
    /// Test ID: RpcV2CborSerializesNullMapValues
  289    283   
    #[::tokio::test]
  290    284   
    #[::tracing_test::traced_test]
  291    285   
    async fn rpc_v2_cbor_serializes_null_map_values_request() {
  292    286   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  293    287   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  294    288   
  295    289   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  296    290   
        let result = client
  297    291   
            .rpc_v2_cbor_sparse_maps()
  298    292   
            .set_sparse_boolean_map(::std::option::Option::Some({
  299    293   
                let mut ret = ::std::collections::HashMap::new();
  300    294   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  301    295   
                ret
  302    296   
            }))
  303    297   
            .set_sparse_number_map(::std::option::Option::Some({
  304    298   
                let mut ret = ::std::collections::HashMap::new();
  305    299   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  306    300   
                ret
  307    301   
            }))
  308    302   
            .set_sparse_string_map(::std::option::Option::Some({
  309    303   
                let mut ret = ::std::collections::HashMap::new();
  310    304   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  311    305   
                ret
  312    306   
            }))
  313    307   
            .set_sparse_struct_map(::std::option::Option::Some({
  314    308   
                let mut ret = ::std::collections::HashMap::new();
  315    309   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  316    310   
                ret
  317    311   
            }))
  318    312   
            .send()
  319    313   
            .await;
  320    314   
        let _ = dbg!(result);
  321    315   
        let http_request = request_receiver.expect_request();
  322         -
        let expected_headers = [
  323         -
            ("Accept", "application/cbor"),
  324         -
            ("Content-Type", "application/cbor"),
  325         -
            ("smithy-protocol", "rpc-v2-cbor"),
  326         -
        ];
         316  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  327    317   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  328    318   
        let required_headers = &["Content-Length"];
  329    319   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  330    320   
        let body = http_request.body().bytes().expect("body should be strict");
  331    321   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  332    322   
            body,
  333    323   
            "v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//",
  334    324   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  335    325   
        ));
  336    326   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  337    327   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  338    328   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  339    329   
    }
  340    330   
  341    331   
    /// A request that contains a sparse map of sets
  342    332   
    /// Test ID: RpcV2CborSerializesSparseSetMap
  343    333   
    #[::tokio::test]
  344    334   
    #[::tracing_test::traced_test]
  345    335   
    async fn rpc_v2_cbor_serializes_sparse_set_map_request() {
  346    336   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  347    337   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  348    338   
  349    339   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  350    340   
        let result = client
  351    341   
            .rpc_v2_cbor_sparse_maps()
  352    342   
            .set_sparse_set_map(::std::option::Option::Some({
  353    343   
                let mut ret = ::std::collections::HashMap::new();
  354    344   
                ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
  355    345   
                ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
  356    346   
                ret
  357    347   
            }))
  358    348   
            .send()
  359    349   
            .await;
  360    350   
        let _ = dbg!(result);
  361    351   
        let http_request = request_receiver.expect_request();
  362         -
        let expected_headers = [
  363         -
            ("Accept", "application/cbor"),
  364         -
            ("Content-Type", "application/cbor"),
  365         -
            ("smithy-protocol", "rpc-v2-cbor"),
  366         -
        ];
         352  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  367    353   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  368    354   
        let required_headers = &["Content-Length"];
  369    355   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  370    356   
        let body = http_request.body().bytes().expect("body should be strict");
  371    357   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  372    358   
            body,
  373    359   
            "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL///8=",
  374    360   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  375    361   
        ));
  376    362   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  377    363   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  378    364   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  379    365   
    }
  380    366   
  381    367   
    /// A request that contains a sparse map of sets.
  382    368   
    /// Test ID: RpcV2CborSerializesSparseSetMapAndRetainsNull
  383    369   
    #[::tokio::test]
  384    370   
    #[::tracing_test::traced_test]
  385    371   
    async fn rpc_v2_cbor_serializes_sparse_set_map_and_retains_null_request() {
  386    372   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  387    373   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  388    374   
  389    375   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  390    376   
        let result = client
  391    377   
            .rpc_v2_cbor_sparse_maps()
  392    378   
            .set_sparse_set_map(::std::option::Option::Some({
  393    379   
                let mut ret = ::std::collections::HashMap::new();
  394    380   
                ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
  395    381   
                ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
  396    382   
                ret.insert("z".to_owned(), ::std::option::Option::None);
  397    383   
                ret
  398    384   
            }))
  399    385   
            .send()
  400    386   
            .await;
  401    387   
        let _ = dbg!(result);
  402    388   
        let http_request = request_receiver.expect_request();
  403         -
        let expected_headers = [
  404         -
            ("Accept", "application/cbor"),
  405         -
            ("Content-Type", "application/cbor"),
  406         -
            ("smithy-protocol", "rpc-v2-cbor"),
  407         -
        ];
         389  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  408    390   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  409    391   
        let required_headers = &["Content-Length"];
  410    392   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  411    393   
        let body = http_request.body().bytes().expect("body should be strict");
  412    394   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  413    395   
            body,
  414    396   
            "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=",
  415    397   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  416    398   
        ));
  417    399   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  418    400   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  419    401   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  420    402   
    }
  421    403   
  422    404   
    /// Ensure that 0 and false are sent over the wire in all maps and lists
  423    405   
    /// Test ID: RpcV2CborSerializesZeroValuesInSparseMaps
  424    406   
    #[::tokio::test]
  425    407   
    #[::tracing_test::traced_test]
  426    408   
    async fn rpc_v2_cbor_serializes_zero_values_in_sparse_maps_request() {
  427    409   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  428    410   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  429    411   
  430    412   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  431    413   
        let result = client
  432    414   
            .rpc_v2_cbor_sparse_maps()
  433    415   
            .set_sparse_number_map(::std::option::Option::Some({
  434    416   
                let mut ret = ::std::collections::HashMap::new();
  435    417   
                ret.insert("x".to_owned(), ::std::option::Option::Some(0));
  436    418   
                ret
  437    419   
            }))
  438    420   
            .set_sparse_boolean_map(::std::option::Option::Some({
  439    421   
                let mut ret = ::std::collections::HashMap::new();
  440    422   
                ret.insert("x".to_owned(), ::std::option::Option::Some(false));
  441    423   
                ret
  442    424   
            }))
  443    425   
            .send()
  444    426   
            .await;
  445    427   
        let _ = dbg!(result);
  446    428   
        let http_request = request_receiver.expect_request();
  447         -
        let expected_headers = [
  448         -
            ("Accept", "application/cbor"),
  449         -
            ("Content-Type", "application/cbor"),
  450         -
            ("smithy-protocol", "rpc-v2-cbor"),
  451         -
        ];
         429  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  452    430   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  453    431   
        let required_headers = &["Content-Length"];
  454    432   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  455    433   
        let body = http_request.body().bytes().expect("body should be strict");
  456    434   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  457    435   
            body,
  458    436   
            "v29zcGFyc2VOdW1iZXJNYXC/YXgA/3BzcGFyc2VCb29sZWFuTWFwv2F49P//",
  459    437   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  460    438   
        ));
  461    439   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/simple_scalar_properties.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(
  191    189   
            crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_input(&input)?,
  192    190   
        );
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -235,233 +468,446 @@
  255    253   
            .set_integer_value(::std::option::Option::Some(256))
  256    254   
            .set_long_value(::std::option::Option::Some(9873))
  257    255   
            .set_short_value(::std::option::Option::Some(9898))
  258    256   
            .set_string_value(::std::option::Option::Some("simple".to_owned()))
  259    257   
            .set_true_boolean_value(::std::option::Option::Some(true))
  260    258   
            .set_blob_value(::std::option::Option::Some(::aws_smithy_types::Blob::new("foo")))
  261    259   
            .send()
  262    260   
            .await;
  263    261   
        let _ = dbg!(result);
  264    262   
        let http_request = request_receiver.expect_request();
  265         -
        let expected_headers = [
  266         -
            ("Accept", "application/cbor"),
  267         -
            ("Content-Type", "application/cbor"),
  268         -
            ("smithy-protocol", "rpc-v2-cbor"),
  269         -
        ];
         263  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  270    264   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  271    265   
        let required_headers = &["Content-Length"];
  272    266   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  273    267   
        let body = http_request.body().bytes().expect("body should be strict");
  274    268   
        ::aws_smithy_protocol_test::assert_ok(
  275    269   
        ::aws_smithy_protocol_test::validate_body(body, "v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  276    270   
        );
  277    271   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  278    272   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  279    273   
        ::pretty_assertions::assert_eq!(
  280    274   
            uri.path(),
  281    275   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  282    276   
            "path was incorrect"
  283    277   
        );
  284    278   
    }
  285    279   
  286    280   
    /// RpcV2 Cbor should not serialize null structure values
  287    281   
    /// Test ID: RpcV2CborClientDoesntSerializeNullStructureValues
  288    282   
    #[::tokio::test]
  289    283   
    #[::tracing_test::traced_test]
  290    284   
    async fn rpc_v2_cbor_client_doesnt_serialize_null_structure_values_request() {
  291    285   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  292    286   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  293    287   
  294    288   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  295    289   
        let result = client
  296    290   
            .simple_scalar_properties()
  297    291   
            .set_string_value(::std::option::Option::None)
  298    292   
            .send()
  299    293   
            .await;
  300    294   
        let _ = dbg!(result);
  301    295   
        let http_request = request_receiver.expect_request();
  302         -
        let expected_headers = [
  303         -
            ("Accept", "application/cbor"),
  304         -
            ("Content-Type", "application/cbor"),
  305         -
            ("smithy-protocol", "rpc-v2-cbor"),
  306         -
        ];
         296  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  307    297   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  308    298   
        let required_headers = &["Content-Length"];
  309    299   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  310    300   
        let body = http_request.body().bytes().expect("body should be strict");
  311    301   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  312    302   
            body,
  313    303   
            "v/8=",
  314    304   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  315    305   
        ));
  316    306   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  317    307   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  318    308   
        ::pretty_assertions::assert_eq!(
  319    309   
            uri.path(),
  320    310   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  321    311   
            "path was incorrect"
  322    312   
        );
  323    313   
    }
  324    314   
  325    315   
    /// Supports handling NaN float values.
  326    316   
    /// Test ID: RpcV2CborSupportsNaNFloatInputs
  327    317   
    #[::tokio::test]
  328    318   
    #[::tracing_test::traced_test]
  329    319   
    async fn rpc_v2_cbor_supports_na_n_float_inputs_request() {
  330    320   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  331    321   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  332    322   
  333    323   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  334    324   
        let result = client
  335    325   
            .simple_scalar_properties()
  336    326   
            .set_double_value(::std::option::Option::Some(
  337    327   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  338    328   
            ))
  339    329   
            .set_float_value(::std::option::Option::Some(
  340    330   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  341    331   
            ))
  342    332   
            .send()
  343    333   
            .await;
  344    334   
        let _ = dbg!(result);
  345    335   
        let http_request = request_receiver.expect_request();
  346         -
        let expected_headers = [
  347         -
            ("Accept", "application/cbor"),
  348         -
            ("Content-Type", "application/cbor"),
  349         -
            ("smithy-protocol", "rpc-v2-cbor"),
  350         -
        ];
         336  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  351    337   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  352    338   
        let required_headers = &["Content-Length"];
  353    339   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  354    340   
        let body = http_request.body().bytes().expect("body should be strict");
  355    341   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  356    342   
            body,
  357    343   
            "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/",
  358    344   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  359    345   
        ));
  360    346   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  361    347   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  362    348   
        ::pretty_assertions::assert_eq!(
  363    349   
            uri.path(),
  364    350   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  365    351   
            "path was incorrect"
  366    352   
        );
  367    353   
    }
  368    354   
  369    355   
    /// Supports handling Infinity float values.
  370    356   
    /// Test ID: RpcV2CborSupportsInfinityFloatInputs
  371    357   
    #[::tokio::test]
  372    358   
    #[::tracing_test::traced_test]
  373    359   
    async fn rpc_v2_cbor_supports_infinity_float_inputs_request() {
  374    360   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  375    361   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  376    362   
  377    363   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  378    364   
        let result = client
  379    365   
            .simple_scalar_properties()
  380    366   
            .set_double_value(::std::option::Option::Some(
  381    367   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  382    368   
            ))
  383    369   
            .set_float_value(::std::option::Option::Some(
  384    370   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  385    371   
            ))
  386    372   
            .send()
  387    373   
            .await;
  388    374   
        let _ = dbg!(result);
  389    375   
        let http_request = request_receiver.expect_request();
  390         -
        let expected_headers = [
  391         -
            ("Accept", "application/cbor"),
  392         -
            ("Content-Type", "application/cbor"),
  393         -
            ("smithy-protocol", "rpc-v2-cbor"),
  394         -
        ];
         376  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  395    377   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  396    378   
        let required_headers = &["Content-Length"];
  397    379   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  398    380   
        let body = http_request.body().bytes().expect("body should be strict");
  399    381   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  400    382   
            body,
  401    383   
            "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/",
  402    384   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  403    385   
        ));
  404    386   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  405    387   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  406    388   
        ::pretty_assertions::assert_eq!(
  407    389   
            uri.path(),
  408    390   
            "/service/RpcV2Protocol/operation/SimpleScalarProperties",
  409    391   
            "path was incorrect"
  410    392   
        );
  411    393   
    }
  412    394   
  413    395   
    /// Supports handling Infinity float values.
  414    396   
    /// Test ID: RpcV2CborSupportsNegativeInfinityFloatInputs
  415    397   
    #[::tokio::test]
  416    398   
    #[::tracing_test::traced_test]
  417    399   
    async fn rpc_v2_cbor_supports_negative_infinity_float_inputs_request() {
  418    400   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  419    401   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  420    402   
  421    403   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  422    404   
        let result = client
  423    405   
            .simple_scalar_properties()
  424    406   
            .set_double_value(::std::option::Option::Some(
  425    407   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
  426    408   
            ))
  427    409   
            .set_float_value(::std::option::Option::Some(
  428    410   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
  429    411   
            ))
  430    412   
            .send()
  431    413   
            .await;
  432    414   
        let _ = dbg!(result);
  433    415   
        let http_request = request_receiver.expect_request();
  434         -
        let expected_headers = [
  435         -
            ("Accept", "application/cbor"),
  436         -
            ("Content-Type", "application/cbor"),
  437         -
            ("smithy-protocol", "rpc-v2-cbor"),
  438         -
        ];
         416  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  439    417   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  440    418   
        let required_headers = &["Content-Length"];
  441    419   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  442    420   
        let body = http_request.body().bytes().expect("body should be strict");
  443    421   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  444    422   
            body,
  445    423   
            "v2tkb3VibGVWYWx1Zfv/8AAAAAAAAGpmbG9hdFZhbHVl+v+AAAD/",
  446    424   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  447    425   
        ));
  448    426   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/sparse_nulls_operation.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_input(
  191    189   
            &input,
  192    190   
        )?);
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
@@ -229,227 +328,318 @@
  249    247   
            .sparse_nulls_operation()
  250    248   
            .set_sparse_string_map(::std::option::Option::Some({
  251    249   
                let mut ret = ::std::collections::HashMap::new();
  252    250   
                ret.insert("foo".to_owned(), ::std::option::Option::None);
  253    251   
                ret
  254    252   
            }))
  255    253   
            .send()
  256    254   
            .await;
  257    255   
        let _ = dbg!(result);
  258    256   
        let http_request = request_receiver.expect_request();
  259         -
        let expected_headers = [
  260         -
            ("Accept", "application/cbor"),
  261         -
            ("Content-Type", "application/cbor"),
  262         -
            ("smithy-protocol", "rpc-v2-cbor"),
  263         -
        ];
         257  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  264    258   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  265    259   
        let required_headers = &["Content-Length"];
  266    260   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  267    261   
        let body = http_request.body().bytes().expect("body should be strict");
  268    262   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  269    263   
            body,
  270    264   
            "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w==",
  271    265   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  272    266   
        ));
  273    267   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  274    268   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  275    269   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/SparseNullsOperation", "path was incorrect");
  276    270   
    }
  277    271   
  278    272   
    /// Serializes null values in lists
  279    273   
    /// Test ID: RpcV2CborSparseListsSerializeNull
  280    274   
    #[::tokio::test]
  281    275   
    #[::tracing_test::traced_test]
  282    276   
    async fn rpc_v2_cbor_sparse_lists_serialize_null_request() {
  283    277   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  284    278   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  285    279   
  286    280   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  287    281   
        let result = client
  288    282   
            .sparse_nulls_operation()
  289    283   
            .set_sparse_string_list(::std::option::Option::Some(vec![::std::option::Option::None]))
  290    284   
            .send()
  291    285   
            .await;
  292    286   
        let _ = dbg!(result);
  293    287   
        let http_request = request_receiver.expect_request();
  294         -
        let expected_headers = [
  295         -
            ("Accept", "application/cbor"),
  296         -
            ("Content-Type", "application/cbor"),
  297         -
            ("smithy-protocol", "rpc-v2-cbor"),
  298         -
        ];
         288  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  299    289   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  300    290   
        let required_headers = &["Content-Length"];
  301    291   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  302    292   
        let body = http_request.body().bytes().expect("body should be strict");
  303    293   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  304    294   
            body,
  305    295   
            "v3BzcGFyc2VTdHJpbmdMaXN0n/b//w==",
  306    296   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  307    297   
        ));
  308    298   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");

tmp-codegen-diff/codegen-client-test/rpcv2Cbor_extras/rust-client-codegen/src/operation/complex_struct_operation.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(
  191    189   
            crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_input(&input)?,
  192    190   
        );
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())

tmp-codegen-diff/codegen-client-test/rpcv2Cbor_extras/rust-client-codegen/src/operation/empty_struct_operation.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_empty_struct_operation::ser_empty_struct_operation_input(
  191    189   
            &input,
  192    190   
        )?);
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())

tmp-codegen-diff/codegen-client-test/rpcv2Cbor_extras/rust-client-codegen/src/operation/error_serialization_operation.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(
  191    189   
            crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_input(&input)?,
  192    190   
        );
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())

tmp-codegen-diff/codegen-client-test/rpcv2Cbor_extras/rust-client-codegen/src/operation/simple_struct_operation.rs

@@ -156,156 +217,215 @@
  176    176   
                builder: ::http::request::Builder,
  177    177   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178    178   
                let mut uri = ::std::string::String::new();
  179    179   
                uri_base(input, &mut uri)?;
  180    180   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181    181   
            }
  182    182   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  183    183   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  184    184   
            builder =
  185    185   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  186         -
            builder =
  187         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  188    186   
            builder
  189    187   
        };
  190    188   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_input(
  191    189   
            &input,
  192    190   
        )?);
  193    191   
        if let Some(content_length) = body.content_length() {
  194    192   
            let content_length = content_length.to_string();
  195    193   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  196    194   
        }
  197    195   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())