Client Test

Client Test

rev. 9f5fb9826a6af51ebfb3736d0a778b00ec7b08b3

Files changed:

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

@@ -193,193 +257,258 @@
  213    213   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  214    214   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  215    215   
        })?;
  216    216   
        cfg.interceptor_state()
  217    217   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  218    218   
        ::std::result::Result::Ok(())
  219    219   
    }
  220    220   
}
  221    221   
#[allow(unreachable_code, unused_variables)]
  222    222   
#[cfg(test)]
  223         -
mod fractional_seconds_request_test {
         223  +
mod fractional_seconds_test {
         224  +
  224    225   
    /// Ensures that clients can correctly parse datetime timestamps with fractional seconds
  225    226   
    /// Test ID: RestJsonDateTimeWithFractionalSeconds
  226    227   
    #[::tokio::test]
  227         -
    #[allow(unused_mut)]
         228  +
    #[::tracing_test::traced_test]
  228    229   
    async fn rest_json_date_time_with_fractional_seconds_response() {
  229    230   
        let expected_output = crate::operation::fractional_seconds::FractionalSecondsOutput::builder()
  230    231   
            .set_datetime(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  231    232   
                946845296, 0.123_f64,
  232    233   
            )))
  233    234   
            .build();
  234    235   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  235    236   
            ::http::response::Builder::new()
  236    237   
                .status(200)
  237    238   
                .body(::aws_smithy_types::body::SdkBody::from(

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

@@ -193,193 +790,791 @@
  213    213   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  214    214   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  215    215   
        })?;
  216    216   
        cfg.interceptor_state()
  217    217   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  218    218   
        ::std::result::Result::Ok(())
  219    219   
    }
  220    220   
}
  221    221   
#[allow(unreachable_code, unused_variables)]
  222    222   
#[cfg(test)]
  223         -
mod greeting_with_errors_request_test {
         223  +
mod greeting_with_errors_test {
         224  +
  224    225   
    /// Ensures that operations with errors successfully know how
  225    226   
    /// to deserialize a successful response. As of January 2021,
  226    227   
    /// server implementations are expected to respond with a
  227    228   
    /// JSON object regardless of if the output parameters are
  228    229   
    /// empty.
  229    230   
    /// Test ID: RestJsonGreetingWithErrors
  230    231   
    #[::tokio::test]
  231         -
    #[allow(unused_mut)]
         232  +
    #[::tracing_test::traced_test]
  232    233   
    async fn rest_json_greeting_with_errors_response() {
  233    234   
        let expected_output = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::builder()
  234    235   
            .set_greeting(::std::option::Option::Some("Hello".to_owned()))
  235    236   
            .build();
  236    237   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  237    238   
            ::http::response::Builder::new()
  238    239   
                .header("X-Greeting", "Hello")
  239    240   
                .status(200)
  240    241   
                .body(::aws_smithy_types::body::SdkBody::from("{}"))
  241    242   
                .unwrap(),
  242    243   
        )
  243    244   
        .unwrap();
  244    245   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  245    246   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  246    247   
  247    248   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  248    249   
        let config = op.config().expect("the operation has config");
  249    250   
        let de = config
  250    251   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  251    252   
            .expect("the config must have a deserializer");
  252    253   
  253    254   
        let parsed = de.deserialize_streaming(&mut http_response);
  254    255   
        let parsed = parsed.unwrap_or_else(|| {
  255    256   
            let http_response =
  256    257   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  257    258   
            de.deserialize_nonstreaming(&http_response)
  258    259   
        });
  259    260   
        let parsed = parsed
  260    261   
            .expect("should be successful response")
  261    262   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsOutput>()
  262    263   
            .unwrap();
  263    264   
        ::pretty_assertions::assert_eq!(parsed.greeting, expected_output.greeting, "Unexpected value for `greeting`");
  264    265   
    }
  265    266   
    /// This test is similar to RestJsonGreetingWithErrors, but it
  266    267   
    /// ensures that clients can gracefully deal with a server
  267    268   
    /// omitting a response payload.
  268    269   
    /// Test ID: RestJsonGreetingWithErrorsNoPayload
  269    270   
    #[::tokio::test]
  270         -
    #[allow(unused_mut)]
         271  +
    #[::tracing_test::traced_test]
  271    272   
    async fn rest_json_greeting_with_errors_no_payload_response() {
  272    273   
        let expected_output = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::builder()
  273    274   
            .set_greeting(::std::option::Option::Some("Hello".to_owned()))
  274    275   
            .build();
  275    276   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  276    277   
            ::http::response::Builder::new()
  277    278   
                .header("X-Greeting", "Hello")
  278    279   
                .status(200)
  279    280   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  280    281   
                .unwrap(),
  281    282   
        )
  282    283   
        .unwrap();
  283    284   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  284    285   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  285    286   
  286    287   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  287    288   
        let config = op.config().expect("the operation has config");
  288    289   
        let de = config
  289    290   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  290    291   
            .expect("the config must have a deserializer");
  291    292   
  292    293   
        let parsed = de.deserialize_streaming(&mut http_response);
  293    294   
        let parsed = parsed.unwrap_or_else(|| {
  294    295   
            let http_response =
  295    296   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  296    297   
            de.deserialize_nonstreaming(&http_response)
  297    298   
        });
  298    299   
        let parsed = parsed
  299    300   
            .expect("should be successful response")
  300    301   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsOutput>()
  301    302   
            .unwrap();
  302    303   
        ::pretty_assertions::assert_eq!(parsed.greeting, expected_output.greeting, "Unexpected value for `greeting`");
  303    304   
    }
  304    305   
    /// Parses simple JSON errors
  305    306   
    /// Test ID: RestJsonInvalidGreetingError
  306    307   
    #[::tokio::test]
  307         -
    #[allow(unused_mut)]
         308  +
    #[::tracing_test::traced_test]
  308    309   
    async fn rest_json_invalid_greeting_error_response() {
  309    310   
        let expected_output = crate::types::error::InvalidGreeting::builder()
  310    311   
            .set_message(::std::option::Option::Some("Hi".to_owned()))
  311    312   
            .build();
  312    313   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  313    314   
            ::http::response::Builder::new()
  314    315   
                .header("Content-Type", "application/json")
  315    316   
                .header("X-Amzn-Errortype", "InvalidGreeting")
  316    317   
                .status(400)
  317    318   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"Message\": \"Hi\"\n}"))
  318    319   
                .unwrap(),
  319    320   
        )
  320    321   
        .unwrap();
  321    322   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  322    323   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  323    324   
  324    325   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  325    326   
        let config = op.config().expect("the operation has config");
  326    327   
        let de = config
  327    328   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  328    329   
            .expect("the config must have a deserializer");
  329    330   
  330    331   
        let parsed = de.deserialize_streaming(&mut http_response);
  331    332   
        let parsed = parsed.unwrap_or_else(|| {
  332    333   
            let http_response =
  333    334   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  334    335   
            de.deserialize_nonstreaming(&http_response)
  335    336   
        });
  336    337   
        let parsed = parsed.expect_err("should be error response");
  337    338   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  338    339   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  339    340   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting(parsed) = parsed {
  340    341   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  341    342   
        } else {
  342    343   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  343    344   
        }
  344    345   
    }
  345    346   
    /// Serializes a complex error with no message member
  346    347   
    /// Test ID: RestJsonComplexErrorWithNoMessage
  347    348   
    #[::tokio::test]
  348         -
    #[allow(unused_mut)]
         349  +
    #[::tracing_test::traced_test]
  349    350   
    async fn rest_json_complex_error_with_no_message_response() {
  350    351   
        let expected_output = crate::types::error::ComplexError::builder()
  351    352   
            .set_header(::std::option::Option::Some("Header".to_owned()))
  352    353   
            .set_top_level(::std::option::Option::Some("Top level".to_owned()))
  353    354   
            .set_nested(::std::option::Option::Some(
  354    355   
                crate::types::ComplexNestedErrorData::builder()
  355    356   
                    .set_foo(::std::option::Option::Some("bar".to_owned()))
  356    357   
                    .build(),
  357    358   
            ))
  358    359   
            .build();
  359    360   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  360    361   
            ::http::response::Builder::new()
  361    362   
                .header("Content-Type", "application/json")
  362    363   
                .header("X-Amzn-Errortype", "ComplexError")
  363    364   
                .header("X-Header", "Header")
  364    365   
                .status(403)
  365    366   
                .body(::aws_smithy_types::body::SdkBody::from(
  366    367   
                    "{\n    \"TopLevel\": \"Top level\",\n    \"Nested\": {\n        \"Fooooo\": \"bar\"\n    }\n}",
  367    368   
                ))
  368    369   
                .unwrap(),
  369    370   
        )
  370    371   
        .unwrap();
  371    372   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  372    373   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  373    374   
  374    375   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  375    376   
        let config = op.config().expect("the operation has config");
  376    377   
        let de = config
  377    378   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  378    379   
            .expect("the config must have a deserializer");
  379    380   
  380    381   
        let parsed = de.deserialize_streaming(&mut http_response);
  381    382   
        let parsed = parsed.unwrap_or_else(|| {
  382    383   
            let http_response =
  383    384   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  384    385   
            de.deserialize_nonstreaming(&http_response)
  385    386   
        });
  386    387   
        let parsed = parsed.expect_err("should be error response");
  387    388   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  388    389   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  389    390   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  390    391   
            ::pretty_assertions::assert_eq!(parsed.header, expected_output.header, "Unexpected value for `header`");
  391    392   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  392    393   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  393    394   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  394    395   
        } else {
  395    396   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  396    397   
        }
  397    398   
    }
  398    399   
    /// Test ID: RestJsonEmptyComplexErrorWithNoMessage
  399    400   
    #[::tokio::test]
  400         -
    #[allow(unused_mut)]
         401  +
    #[::tracing_test::traced_test]
  401    402   
    async fn rest_json_empty_complex_error_with_no_message_response() {
  402    403   
        let expected_output = crate::types::error::ComplexError::builder().build();
  403    404   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  404    405   
            ::http::response::Builder::new()
  405    406   
                .header("Content-Type", "application/json")
  406    407   
                .header("X-Amzn-Errortype", "ComplexError")
  407    408   
                .status(403)
  408    409   
                .body(::aws_smithy_types::body::SdkBody::from("{}"))
  409    410   
                .unwrap(),
  410    411   
        )
  411    412   
        .unwrap();
  412    413   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  413    414   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  414    415   
  415    416   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  416    417   
        let config = op.config().expect("the operation has config");
  417    418   
        let de = config
  418    419   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  419    420   
            .expect("the config must have a deserializer");
  420    421   
  421    422   
        let parsed = de.deserialize_streaming(&mut http_response);
  422    423   
        let parsed = parsed.unwrap_or_else(|| {
  423    424   
            let http_response =
  424    425   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  425    426   
            de.deserialize_nonstreaming(&http_response)
  426    427   
        });
  427    428   
        let parsed = parsed.expect_err("should be error response");
  428    429   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  429    430   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  430    431   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  431    432   
            ::pretty_assertions::assert_eq!(parsed.header, expected_output.header, "Unexpected value for `header`");
  432    433   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  433    434   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  434    435   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  435    436   
        } else {
  436    437   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  437    438   
        }
  438    439   
    }
  439    440   
    /// Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS.
  440    441   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorType
  441    442   
    #[::tokio::test]
  442         -
    #[allow(unused_mut)]
         443  +
    #[::tracing_test::traced_test]
  443    444   
    async fn rest_json_foo_error_using_x_amzn_error_type_response() {
  444    445   
        let expected_output = crate::types::error::FooError::builder().build();
  445    446   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  446    447   
            ::http::response::Builder::new()
  447    448   
                .header("X-Amzn-Errortype", "FooError")
  448    449   
                .status(500)
  449    450   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  450    451   
                .unwrap(),
  451    452   
        )
  452    453   
        .unwrap();
  453    454   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  454    455   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  455    456   
  456    457   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  457    458   
        let config = op.config().expect("the operation has config");
  458    459   
        let de = config
  459    460   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  460    461   
            .expect("the config must have a deserializer");
  461    462   
  462    463   
        let parsed = de.deserialize_streaming(&mut http_response);
  463    464   
        let parsed = parsed.unwrap_or_else(|| {
  464    465   
            let http_response =
  465    466   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  466    467   
            de.deserialize_nonstreaming(&http_response)
  467    468   
        });
  468    469   
        let parsed = parsed.expect_err("should be error response");
  469    470   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  470    471   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  471    472   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  472    473   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  473    474   
        } else {
  474    475   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  475    476   
        }
  476    477   
    }
  477    478   
    /// Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/'
  478    479   
    /// is to be interpreted as 'ValidationException'.
  479    480   
    ///
  480    481   
    /// For an example service see Amazon Polly.
  481    482   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorTypeWithUri
  482    483   
    #[::tokio::test]
  483         -
    #[allow(unused_mut)]
         484  +
    #[::tracing_test::traced_test]
  484    485   
    async fn rest_json_foo_error_using_x_amzn_error_type_with_uri_response() {
  485    486   
        let expected_output = crate::types::error::FooError::builder().build();
  486    487   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  487    488   
            ::http::response::Builder::new()
  488    489   
                .header("X-Amzn-Errortype", "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/")
  489    490   
                .status(500)
  490    491   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  491    492   
                .unwrap(),
  492    493   
        )
  493    494   
        .unwrap();
  494    495   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  495    496   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  496    497   
  497    498   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  498    499   
        let config = op.config().expect("the operation has config");
  499    500   
        let de = config
  500    501   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  501    502   
            .expect("the config must have a deserializer");
  502    503   
  503    504   
        let parsed = de.deserialize_streaming(&mut http_response);
  504    505   
        let parsed = parsed.unwrap_or_else(|| {
  505    506   
            let http_response =
  506    507   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  507    508   
            de.deserialize_nonstreaming(&http_response)
  508    509   
        });
  509    510   
        let parsed = parsed.expect_err("should be error response");
  510    511   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  511    512   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  512    513   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  513    514   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  514    515   
        } else {
  515    516   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  516    517   
        }
  517    518   
    }
  518    519   
    /// X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service.
  519    520   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorTypeWithUriAndNamespace
  520    521   
    #[::tokio::test]
  521         -
    #[allow(unused_mut)]
         522  +
    #[::tracing_test::traced_test]
  522    523   
    async fn rest_json_foo_error_using_x_amzn_error_type_with_uri_and_namespace_response() {
  523    524   
        let expected_output = crate::types::error::FooError::builder().build();
  524    525   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  525    526   
            ::http::response::Builder::new()
  526    527   
                .header(
  527    528   
                    "X-Amzn-Errortype",
  528    529   
                    "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/",
  529    530   
                )
  530    531   
                .status(500)
  531    532   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  532    533   
                .unwrap(),
  533    534   
        )
  534    535   
        .unwrap();
  535    536   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  536    537   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  537    538   
  538    539   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  539    540   
        let config = op.config().expect("the operation has config");
  540    541   
        let de = config
  541    542   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  542    543   
            .expect("the config must have a deserializer");
  543    544   
  544    545   
        let parsed = de.deserialize_streaming(&mut http_response);
  545    546   
        let parsed = parsed.unwrap_or_else(|| {
  546    547   
            let http_response =
  547    548   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  548    549   
            de.deserialize_nonstreaming(&http_response)
  549    550   
        });
  550    551   
        let parsed = parsed.expect_err("should be error response");
  551    552   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  552    553   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  553    554   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  554    555   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  555    556   
        } else {
  556    557   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  557    558   
        }
  558    559   
    }
  559    560   
    /// This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property.
  560    561   
    ///
  561    562   
    /// For example service see Amazon S3 Glacier.
  562    563   
    /// Test ID: RestJsonFooErrorUsingCode
  563    564   
    #[::tokio::test]
  564         -
    #[allow(unused_mut)]
         565  +
    #[::tracing_test::traced_test]
  565    566   
    async fn rest_json_foo_error_using_code_response() {
  566    567   
        let expected_output = crate::types::error::FooError::builder().build();
  567    568   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  568    569   
            ::http::response::Builder::new()
  569    570   
                .header("Content-Type", "application/json")
  570    571   
                .status(500)
  571    572   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"code\": \"FooError\"\n}"))
  572    573   
                .unwrap(),
  573    574   
        )
  574    575   
        .unwrap();
  575    576   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  576    577   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  577    578   
  578    579   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  579    580   
        let config = op.config().expect("the operation has config");
  580    581   
        let de = config
  581    582   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  582    583   
            .expect("the config must have a deserializer");
  583    584   
  584    585   
        let parsed = de.deserialize_streaming(&mut http_response);
  585    586   
        let parsed = parsed.unwrap_or_else(|| {
  586    587   
            let http_response =
  587    588   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  588    589   
            de.deserialize_nonstreaming(&http_response)
  589    590   
        });
  590    591   
        let parsed = parsed.expect_err("should be error response");
  591    592   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  592    593   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  593    594   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  594    595   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  595    596   
        } else {
  596    597   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  597    598   
        }
  598    599   
    }
  599    600   
    /// Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  600    601   
    /// Test ID: RestJsonFooErrorUsingCodeAndNamespace
  601    602   
    #[::tokio::test]
  602         -
    #[allow(unused_mut)]
         603  +
    #[::tracing_test::traced_test]
  603    604   
    async fn rest_json_foo_error_using_code_and_namespace_response() {
  604    605   
        let expected_output = crate::types::error::FooError::builder().build();
  605    606   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  606    607   
            ::http::response::Builder::new()
  607    608   
                .header("Content-Type", "application/json")
  608    609   
                .status(500)
  609    610   
                .body(::aws_smithy_types::body::SdkBody::from(
  610    611   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError\"\n}",
  611    612   
                ))
  612    613   
                .unwrap(),
  613    614   
        )
  614    615   
        .unwrap();
  615    616   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  616    617   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  617    618   
  618    619   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  619    620   
        let config = op.config().expect("the operation has config");
  620    621   
        let de = config
  621    622   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  622    623   
            .expect("the config must have a deserializer");
  623    624   
  624    625   
        let parsed = de.deserialize_streaming(&mut http_response);
  625    626   
        let parsed = parsed.unwrap_or_else(|| {
  626    627   
            let http_response =
  627    628   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  628    629   
            de.deserialize_nonstreaming(&http_response)
  629    630   
        });
  630    631   
        let parsed = parsed.expect_err("should be error response");
  631    632   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  632    633   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  633    634   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  634    635   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  635    636   
        } else {
  636    637   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  637    638   
        }
  638    639   
    }
  639    640   
    /// Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service.
  640    641   
    /// Test ID: RestJsonFooErrorUsingCodeUriAndNamespace
  641    642   
    #[::tokio::test]
  642         -
    #[allow(unused_mut)]
         643  +
    #[::tracing_test::traced_test]
  643    644   
    async fn rest_json_foo_error_using_code_uri_and_namespace_response() {
  644    645   
        let expected_output = crate::types::error::FooError::builder().build();
  645    646   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  646    647   
            ::http::response::Builder::new()
  647    648   
                .header("Content-Type", "application/json")
  648    649   
                .status(500)
  649    650   
                .body(::aws_smithy_types::body::SdkBody::from(
  650    651   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  651    652   
                ))
  652    653   
                .unwrap(),
  653    654   
        )
  654    655   
        .unwrap();
  655    656   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  656    657   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  657    658   
  658    659   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  659    660   
        let config = op.config().expect("the operation has config");
  660    661   
        let de = config
  661    662   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  662    663   
            .expect("the config must have a deserializer");
  663    664   
  664    665   
        let parsed = de.deserialize_streaming(&mut http_response);
  665    666   
        let parsed = parsed.unwrap_or_else(|| {
  666    667   
            let http_response =
  667    668   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  668    669   
            de.deserialize_nonstreaming(&http_response)
  669    670   
        });
  670    671   
        let parsed = parsed.expect_err("should be error response");
  671    672   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  672    673   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  673    674   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  674    675   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  675    676   
        } else {
  676    677   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  677    678   
        }
  678    679   
    }
  679    680   
    /// Some services serialize errors using __type.
  680    681   
    /// Test ID: RestJsonFooErrorWithDunderType
  681    682   
    #[::tokio::test]
  682         -
    #[allow(unused_mut)]
         683  +
    #[::tracing_test::traced_test]
  683    684   
    async fn rest_json_foo_error_with_dunder_type_response() {
  684    685   
        let expected_output = crate::types::error::FooError::builder().build();
  685    686   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  686    687   
            ::http::response::Builder::new()
  687    688   
                .header("Content-Type", "application/json")
  688    689   
                .status(500)
  689    690   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"__type\": \"FooError\"\n}"))
  690    691   
                .unwrap(),
  691    692   
        )
  692    693   
        .unwrap();
  693    694   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  694    695   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  695    696   
  696    697   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  697    698   
        let config = op.config().expect("the operation has config");
  698    699   
        let de = config
  699    700   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  700    701   
            .expect("the config must have a deserializer");
  701    702   
  702    703   
        let parsed = de.deserialize_streaming(&mut http_response);
  703    704   
        let parsed = parsed.unwrap_or_else(|| {
  704    705   
            let http_response =
  705    706   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  706    707   
            de.deserialize_nonstreaming(&http_response)
  707    708   
        });
  708    709   
        let parsed = parsed.expect_err("should be error response");
  709    710   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  710    711   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  711    712   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  712    713   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  713    714   
        } else {
  714    715   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  715    716   
        }
  716    717   
    }
  717    718   
    /// Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  718    719   
    /// Test ID: RestJsonFooErrorWithDunderTypeAndNamespace
  719    720   
    #[::tokio::test]
  720         -
    #[allow(unused_mut)]
         721  +
    #[::tracing_test::traced_test]
  721    722   
    async fn rest_json_foo_error_with_dunder_type_and_namespace_response() {
  722    723   
        let expected_output = crate::types::error::FooError::builder().build();
  723    724   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  724    725   
            ::http::response::Builder::new()
  725    726   
                .header("Content-Type", "application/json")
  726    727   
                .status(500)
  727    728   
                .body(::aws_smithy_types::body::SdkBody::from(
  728    729   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError\"\n}",
  729    730   
                ))
  730    731   
                .unwrap(),
  731    732   
        )
  732    733   
        .unwrap();
  733    734   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  734    735   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  735    736   
  736    737   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  737    738   
        let config = op.config().expect("the operation has config");
  738    739   
        let de = config
  739    740   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  740    741   
            .expect("the config must have a deserializer");
  741    742   
  742    743   
        let parsed = de.deserialize_streaming(&mut http_response);
  743    744   
        let parsed = parsed.unwrap_or_else(|| {
  744    745   
            let http_response =
  745    746   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  746    747   
            de.deserialize_nonstreaming(&http_response)
  747    748   
        });
  748    749   
        let parsed = parsed.expect_err("should be error response");
  749    750   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  750    751   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  751    752   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  752    753   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  753    754   
        } else {
  754    755   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  755    756   
        }
  756    757   
    }
  757    758   
    /// Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service.
  758    759   
    /// Test ID: RestJsonFooErrorWithDunderTypeUriAndNamespace
  759    760   
    #[::tokio::test]
  760         -
    #[allow(unused_mut)]
         761  +
    #[::tracing_test::traced_test]
  761    762   
    async fn rest_json_foo_error_with_dunder_type_uri_and_namespace_response() {
  762    763   
        let expected_output = crate::types::error::FooError::builder().build();
  763    764   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  764    765   
            ::http::response::Builder::new()
  765    766   
                .header("Content-Type", "application/json")
  766    767   
                .status(500)
  767    768   
                .body(::aws_smithy_types::body::SdkBody::from(
  768    769   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  769    770   
                ))
  770    771   
                .unwrap(),

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

@@ -193,193 +257,258 @@
  213    213   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  214    214   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  215    215   
        })?;
  216    216   
        cfg.interceptor_state()
  217    217   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  218    218   
        ::std::result::Result::Ok(())
  219    219   
    }
  220    220   
}
  221    221   
#[allow(unreachable_code, unused_variables)]
  222    222   
#[cfg(test)]
  223         -
mod host_with_path_operation_request_test {
         223  +
mod host_with_path_operation_test {
         224  +
  224    225   
    /// Custom endpoints supplied by users can have paths
  225    226   
    /// Test ID: RestJsonHostWithPath
  226    227   
    #[::tokio::test]
  227         -
    #[allow(unused_mut)]
         228  +
    #[::tracing_test::traced_test]
  228    229   
    async fn rest_json_host_with_path_request() {
  229    230   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  230    231   
        let config_builder = crate::config::Config::builder()
  231    232   
            .with_test_defaults()
  232    233   
            .endpoint_url("https://example.com/custom");
  233    234   
  234    235   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  235    236   
        let result = client.host_with_path_operation().send().await;
  236    237   
        let _ = dbg!(result);
  237    238   
        let http_request = request_receiver.expect_request();

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

@@ -201,201 +265,266 @@
  221    221   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  222    222   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  223    223   
        })?;
  224    224   
        cfg.interceptor_state()
  225    225   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  226    226   
        ::std::result::Result::Ok(())
  227    227   
    }
  228    228   
}
  229    229   
#[allow(unreachable_code, unused_variables)]
  230    230   
#[cfg(test)]
  231         -
mod http_checksum_required_request_test {
         231  +
mod http_checksum_required_test {
         232  +
  232    233   
    /// Adds Content-MD5 header
  233    234   
    /// Test ID: RestJsonHttpChecksumRequired
  234    235   
    #[::tokio::test]
  235         -
    #[allow(unused_mut)]
         236  +
    #[::tracing_test::traced_test]
  236    237   
    async fn rest_json_http_checksum_required_request() {
  237    238   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  238    239   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  239    240   
  240    241   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  241    242   
        let result = client
  242    243   
            .http_checksum_required()
  243    244   
            .set_foo(::std::option::Option::Some("base64 encoded md5 checksum".to_owned()))
  244    245   
            .send()
  245    246   
            .await;

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

@@ -193,193 +283,284 @@
  213    213   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  214    214   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  215    215   
        })?;
  216    216   
        cfg.interceptor_state()
  217    217   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  218    218   
        ::std::result::Result::Ok(())
  219    219   
    }
  220    220   
}
  221    221   
#[allow(unreachable_code, unused_variables)]
  222    222   
#[cfg(test)]
  223         -
mod http_enum_payload_request_test {
         223  +
mod http_enum_payload_test {
         224  +
  224    225   
    /// Test ID: RestJsonEnumPayloadRequest
  225    226   
    #[::tokio::test]
  226         -
    #[allow(unused_mut)]
         227  +
    #[::tracing_test::traced_test]
  227    228   
    async fn rest_json_enum_payload_request_request() {
  228    229   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  229    230   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  230    231   
  231    232   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  232    233   
        let result = client
  233    234   
            .http_enum_payload()
  234    235   
            .set_payload(::std::option::Option::Some(
  235    236   
                "enumvalue".parse::<crate::types::StringEnum>().expect("static value validated to member"),
  236    237   
            ))
  237    238   
            .send()
  238    239   
            .await;
  239    240   
        let _ = dbg!(result);
  240    241   
        let http_request = request_receiver.expect_request();
  241    242   
        let body = http_request.body().bytes().expect("body should be strict");
  242    243   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  243    244   
            body,
  244    245   
            "enumvalue",
  245    246   
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  246    247   
        ));
  247    248   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  248    249   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  249    250   
        ::pretty_assertions::assert_eq!(uri.path(), "/EnumPayload", "path was incorrect");
  250    251   
    }
  251    252   
    /// Test ID: RestJsonEnumPayloadResponse
  252    253   
    #[::tokio::test]
  253         -
    #[allow(unused_mut)]
         254  +
    #[::tracing_test::traced_test]
  254    255   
    async fn rest_json_enum_payload_response_response() {
  255    256   
        let expected_output = crate::operation::http_enum_payload::HttpEnumPayloadOutput::builder()
  256    257   
            .set_payload(::std::option::Option::Some(
  257    258   
                "enumvalue".parse::<crate::types::StringEnum>().expect("static value validated to member"),
  258    259   
            ))
  259    260   
            .build();
  260    261   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  261    262   
            ::http::response::Builder::new()
  262    263   
                .status(200)
  263    264   
                .body(::aws_smithy_types::body::SdkBody::from("enumvalue"))

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

@@ -199,199 +358,359 @@
  219    219   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  220    220   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  221    221   
        })?;
  222    222   
        cfg.interceptor_state()
  223    223   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  224    224   
        ::std::result::Result::Ok(())
  225    225   
    }
  226    226   
}
  227    227   
#[allow(unreachable_code, unused_variables)]
  228    228   
#[cfg(test)]
  229         -
mod http_payload_traits_request_test {
         229  +
mod http_payload_traits_test {
         230  +
  230    231   
    /// Serializes a blob in the HTTP payload
  231    232   
    /// Test ID: RestJsonHttpPayloadTraitsWithBlob
  232    233   
    #[::tokio::test]
  233         -
    #[allow(unused_mut)]
         234  +
    #[::tracing_test::traced_test]
  234    235   
    async fn rest_json_http_payload_traits_with_blob_request() {
  235    236   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  236    237   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  237    238   
  238    239   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  239    240   
        let result = client
  240    241   
            .http_payload_traits()
  241    242   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  242    243   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::Blob::new("blobby blob blob")))
  243    244   
            .send()
  244    245   
            .await;
  245    246   
        let _ = dbg!(result);
  246    247   
        let http_request = request_receiver.expect_request();
  247    248   
        let expected_headers = [("Content-Type", "application/octet-stream"), ("X-Foo", "Foo")];
  248    249   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  249    250   
        let required_headers = &["Content-Length"];
  250    251   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  251    252   
        let body = http_request.body().bytes().expect("body should be strict");
  252    253   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  253    254   
            body,
  254    255   
            "blobby blob blob",
  255    256   
            ::aws_smithy_protocol_test::MediaType::from("application/octet-stream"),
  256    257   
        ));
  257    258   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  258    259   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  259    260   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadTraits", "path was incorrect");
  260    261   
    }
  261    262   
    /// Serializes an empty blob in the HTTP payload
  262    263   
    /// Test ID: RestJsonHttpPayloadTraitsWithNoBlobBody
  263    264   
    #[::tokio::test]
  264         -
    #[allow(unused_mut)]
         265  +
    #[::tracing_test::traced_test]
  265    266   
    async fn rest_json_http_payload_traits_with_no_blob_body_request() {
  266    267   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  267    268   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  268    269   
  269    270   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  270    271   
        let result = client
  271    272   
            .http_payload_traits()
  272    273   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  273    274   
            .send()
  274    275   
            .await;
  275    276   
        let _ = dbg!(result);
  276    277   
        let http_request = request_receiver.expect_request();
  277    278   
        let expected_headers = [("X-Foo", "Foo")];
  278    279   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  279    280   
        let body = http_request.body().bytes().expect("body should be strict");
  280    281   
        // No body
  281    282   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  282    283   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  283    284   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  284    285   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadTraits", "path was incorrect");
  285    286   
    }
  286    287   
    /// Serializes a blob in the HTTP payload
  287    288   
    /// Test ID: RestJsonHttpPayloadTraitsWithBlob
  288    289   
    #[::tokio::test]
  289         -
    #[allow(unused_mut)]
         290  +
    #[::tracing_test::traced_test]
  290    291   
    async fn rest_json_http_payload_traits_with_blob_response() {
  291    292   
        let expected_output = crate::operation::http_payload_traits::HttpPayloadTraitsOutput::builder()
  292    293   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  293    294   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::Blob::new("blobby blob blob")))
  294    295   
            .build();
  295    296   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  296    297   
            ::http::response::Builder::new()
  297    298   
                .header("X-Foo", "Foo")
  298    299   
                .status(200)
  299    300   
                .body(::aws_smithy_types::body::SdkBody::from("blobby blob blob"))
  300    301   
                .unwrap(),
  301    302   
        )
  302    303   
        .unwrap();
  303    304   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  304    305   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  305    306   
  306    307   
        let op = crate::operation::http_payload_traits::HttpPayloadTraits::new();
  307    308   
        let config = op.config().expect("the operation has config");
  308    309   
        let de = config
  309    310   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  310    311   
            .expect("the config must have a deserializer");
  311    312   
  312    313   
        let parsed = de.deserialize_streaming(&mut http_response);
  313    314   
        let parsed = parsed.unwrap_or_else(|| {
  314    315   
            let http_response =
  315    316   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  316    317   
            de.deserialize_nonstreaming(&http_response)
  317    318   
        });
  318    319   
        let parsed = parsed
  319    320   
            .expect("should be successful response")
  320    321   
            .downcast::<crate::operation::http_payload_traits::HttpPayloadTraitsOutput>()
  321    322   
            .unwrap();
  322    323   
        ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
  323    324   
        ::pretty_assertions::assert_eq!(parsed.blob, expected_output.blob, "Unexpected value for `blob`");
  324    325   
    }
  325    326   
    /// Serializes an empty blob in the HTTP payload
  326    327   
    /// Test ID: RestJsonHttpPayloadTraitsWithNoBlobBody
  327    328   
    #[::tokio::test]
  328         -
    #[allow(unused_mut)]
         329  +
    #[::tracing_test::traced_test]
  329    330   
    async fn rest_json_http_payload_traits_with_no_blob_body_response() {
  330    331   
        let expected_output = crate::operation::http_payload_traits::HttpPayloadTraitsOutput::builder()
  331    332   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  332    333   
            .build();
  333    334   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  334    335   
            ::http::response::Builder::new()
  335    336   
                .header("X-Foo", "Foo")
  336    337   
                .status(200)
  337    338   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  338    339   
                .unwrap(),

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

@@ -204,204 +299,300 @@
  224    224   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  225    225   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  226    226   
        })?;
  227    227   
        cfg.interceptor_state()
  228    228   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  229    229   
        ::std::result::Result::Ok(())
  230    230   
    }
  231    231   
}
  232    232   
#[allow(unreachable_code, unused_variables)]
  233    233   
#[cfg(test)]
  234         -
mod http_payload_traits_with_media_type_request_test {
         234  +
mod http_payload_traits_with_media_type_test {
         235  +
  235    236   
    /// Serializes a blob in the HTTP payload with a content-type
  236    237   
    /// Test ID: RestJsonHttpPayloadTraitsWithMediaTypeWithBlob
  237    238   
    #[::tokio::test]
  238         -
    #[allow(unused_mut)]
         239  +
    #[::tracing_test::traced_test]
  239    240   
    async fn rest_json_http_payload_traits_with_media_type_with_blob_request() {
  240    241   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  241    242   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  242    243   
  243    244   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  244    245   
        let result = client
  245    246   
            .http_payload_traits_with_media_type()
  246    247   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  247    248   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::Blob::new("blobby blob blob")))
  248    249   
            .send()
  249    250   
            .await;
  250    251   
        let _ = dbg!(result);
  251    252   
        let http_request = request_receiver.expect_request();
  252    253   
        let expected_headers = [("Content-Type", "text/plain"), ("X-Foo", "Foo")];
  253    254   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  254    255   
        let required_headers = &["Content-Length"];
  255    256   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  256    257   
        let body = http_request.body().bytes().expect("body should be strict");
  257    258   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  258    259   
            body,
  259    260   
            "blobby blob blob",
  260    261   
            ::aws_smithy_protocol_test::MediaType::from("application/octet-stream"),
  261    262   
        ));
  262    263   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  263    264   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  264    265   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadTraitsWithMediaType", "path was incorrect");
  265    266   
    }
  266    267   
    /// Serializes a blob in the HTTP payload with a content-type
  267    268   
    /// Test ID: RestJsonHttpPayloadTraitsWithMediaTypeWithBlob
  268    269   
    #[::tokio::test]
  269         -
    #[allow(unused_mut)]
         270  +
    #[::tracing_test::traced_test]
  270    271   
    async fn rest_json_http_payload_traits_with_media_type_with_blob_response() {
  271    272   
        let expected_output = crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput::builder()
  272    273   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  273    274   
            .set_blob(::std::option::Option::Some(::aws_smithy_types::Blob::new("blobby blob blob")))
  274    275   
            .build();
  275    276   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  276    277   
            ::http::response::Builder::new()
  277    278   
                .header("Content-Type", "text/plain")
  278    279   
                .header("X-Foo", "Foo")
  279    280   
                .status(200)

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

@@ -199,199 +298,299 @@
  219    219   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  220    220   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  221    221   
        })?;
  222    222   
        cfg.interceptor_state()
  223    223   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  224    224   
        ::std::result::Result::Ok(())
  225    225   
    }
  226    226   
}
  227    227   
#[allow(unreachable_code, unused_variables)]
  228    228   
#[cfg(test)]
  229         -
mod http_payload_with_structure_request_test {
         229  +
mod http_payload_with_structure_test {
         230  +
  230    231   
    /// Serializes a structure in the payload
  231    232   
    /// Test ID: RestJsonHttpPayloadWithStructure
  232    233   
    #[::tokio::test]
  233         -
    #[allow(unused_mut)]
         234  +
    #[::tracing_test::traced_test]
  234    235   
    async fn rest_json_http_payload_with_structure_request() {
  235    236   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  236    237   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  237    238   
  238    239   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  239    240   
        let result = client
  240    241   
            .http_payload_with_structure()
  241    242   
            .set_nested(::std::option::Option::Some(
  242    243   
                crate::types::NestedPayload::builder()
  243    244   
                    .set_greeting(::std::option::Option::Some("hello".to_owned()))
  244    245   
                    .set_name(::std::option::Option::Some("Phreddy".to_owned()))
  245    246   
                    .build(),
  246    247   
            ))
  247    248   
            .send()
  248    249   
            .await;
  249    250   
        let _ = dbg!(result);
  250    251   
        let http_request = request_receiver.expect_request();
  251    252   
        let expected_headers = [("Content-Type", "application/json")];
  252    253   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  253    254   
        let required_headers = &["Content-Length"];
  254    255   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  255    256   
        let body = http_request.body().bytes().expect("body should be strict");
  256    257   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  257    258   
            body,
  258    259   
            "{\n    \"greeting\": \"hello\",\n    \"name\": \"Phreddy\"\n}",
  259    260   
            ::aws_smithy_protocol_test::MediaType::from("application/json"),
  260    261   
        ));
  261    262   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  262    263   
        ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
  263    264   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadWithStructure", "path was incorrect");
  264    265   
    }
  265    266   
    /// Serializes a structure in the payload
  266    267   
    /// Test ID: RestJsonHttpPayloadWithStructure
  267    268   
    #[::tokio::test]
  268         -
    #[allow(unused_mut)]
         269  +
    #[::tracing_test::traced_test]
  269    270   
    async fn rest_json_http_payload_with_structure_response() {
  270    271   
        let expected_output = crate::operation::http_payload_with_structure::HttpPayloadWithStructureOutput::builder()
  271    272   
            .set_nested(::std::option::Option::Some(
  272    273   
                crate::types::NestedPayload::builder()
  273    274   
                    .set_greeting(::std::option::Option::Some("hello".to_owned()))
  274    275   
                    .set_name(::std::option::Option::Some("Phreddy".to_owned()))
  275    276   
                    .build(),
  276    277   
            ))
  277    278   
            .build();
  278    279   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(

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

@@ -199,199 +349,350 @@
  219    219   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  220    220   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  221    221   
        })?;
  222    222   
        cfg.interceptor_state()
  223    223   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  224    224   
        ::std::result::Result::Ok(())
  225    225   
    }
  226    226   
}
  227    227   
#[allow(unreachable_code, unused_variables)]
  228    228   
#[cfg(test)]
  229         -
mod http_payload_with_union_request_test {
         229  +
mod http_payload_with_union_test {
         230  +
  230    231   
    /// Serializes a union in the payload.
  231    232   
    /// Test ID: RestJsonHttpPayloadWithUnion
  232    233   
    #[::tokio::test]
  233         -
    #[allow(unused_mut)]
         234  +
    #[::tracing_test::traced_test]
  234    235   
    async fn rest_json_http_payload_with_union_request() {
  235    236   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  236    237   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  237    238   
  238    239   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  239    240   
        let result = client
  240    241   
            .http_payload_with_union()
  241    242   
            .set_nested(::std::option::Option::Some(crate::types::UnionPayload::Greeting("hello".to_owned())))
  242    243   
            .send()
  243    244   
            .await;
  244    245   
        let _ = dbg!(result);
  245    246   
        let http_request = request_receiver.expect_request();
  246    247   
        let expected_headers = [("Content-Type", "application/json")];
  247    248   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  248    249   
        let required_headers = &["Content-Length"];
  249    250   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  250    251   
        let body = http_request.body().bytes().expect("body should be strict");
  251    252   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  252    253   
            body,
  253    254   
            "{\n    \"greeting\": \"hello\"\n}",
  254    255   
            ::aws_smithy_protocol_test::MediaType::from("application/json"),
  255    256   
        ));
  256    257   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  257    258   
        ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
  258    259   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadWithUnion", "path was incorrect");
  259    260   
    }
  260    261   
    /// No payload is sent if the union has no value.
  261    262   
    /// Test ID: RestJsonHttpPayloadWithUnsetUnion
  262    263   
    #[::tokio::test]
  263         -
    #[allow(unused_mut)]
         264  +
    #[::tracing_test::traced_test]
  264    265   
    async fn rest_json_http_payload_with_unset_union_request() {
  265    266   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  266    267   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  267    268   
  268    269   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  269    270   
        let result = client.http_payload_with_union().send().await;
  270    271   
        let _ = dbg!(result);
  271    272   
        let http_request = request_receiver.expect_request();
  272    273   
        let body = http_request.body().bytes().expect("body should be strict");
  273    274   
        // No body
  274    275   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  275    276   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  276    277   
        ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
  277    278   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPayloadWithUnion", "path was incorrect");
  278    279   
    }
  279    280   
    /// Serializes a union in the payload.
  280    281   
    /// Test ID: RestJsonHttpPayloadWithUnion
  281    282   
    #[::tokio::test]
  282         -
    #[allow(unused_mut)]
         283  +
    #[::tracing_test::traced_test]
  283    284   
    async fn rest_json_http_payload_with_union_response() {
  284    285   
        let expected_output = crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput::builder()
  285    286   
            .set_nested(::std::option::Option::Some(crate::types::UnionPayload::Greeting("hello".to_owned())))
  286    287   
            .build();
  287    288   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  288    289   
            ::http::response::Builder::new()
  289    290   
                .header("Content-Type", "application/json")
  290    291   
                .status(200)
  291    292   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"greeting\": \"hello\"\n}"))
  292    293   
                .unwrap(),
  293    294   
        )
  294    295   
        .unwrap();
  295    296   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  296    297   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  297    298   
  298    299   
        let op = crate::operation::http_payload_with_union::HttpPayloadWithUnion::new();
  299    300   
        let config = op.config().expect("the operation has config");
  300    301   
        let de = config
  301    302   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  302    303   
            .expect("the config must have a deserializer");
  303    304   
  304    305   
        let parsed = de.deserialize_streaming(&mut http_response);
  305    306   
        let parsed = parsed.unwrap_or_else(|| {
  306    307   
            let http_response =
  307    308   
                http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
  308    309   
            de.deserialize_nonstreaming(&http_response)
  309    310   
        });
  310    311   
        let parsed = parsed
  311    312   
            .expect("should be successful response")
  312    313   
            .downcast::<crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput>()
  313    314   
            .unwrap();
  314    315   
        ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  315    316   
    }
  316    317   
    /// No payload is sent if the union has no value.
  317    318   
    /// Test ID: RestJsonHttpPayloadWithUnsetUnion
  318    319   
    #[::tokio::test]
  319         -
    #[allow(unused_mut)]
         320  +
    #[::tracing_test::traced_test]
  320    321   
    async fn rest_json_http_payload_with_unset_union_response() {
  321    322   
        let expected_output = crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput::builder().build();
  322    323   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  323    324   
            ::http::response::Builder::new()
  324    325   
                .header("Content-Length", "0")
  325    326   
                .status(200)
  326    327   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  327    328   
                .unwrap(),
  328    329   
        )
  329    330   
        .unwrap();

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

@@ -194,194 +315,316 @@
  214    214   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  215    215   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  216    216   
        })?;
  217    217   
        cfg.interceptor_state()
  218    218   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  219    219   
        ::std::result::Result::Ok(())
  220    220   
    }
  221    221   
}
  222    222   
#[allow(unreachable_code, unused_variables)]
  223    223   
#[cfg(test)]
  224         -
mod http_prefix_headers_request_test {
         224  +
mod http_prefix_headers_test {
         225  +
  225    226   
    /// Adds headers by prefix
  226    227   
    /// Test ID: RestJsonHttpPrefixHeadersArePresent
  227    228   
    #[::tokio::test]
  228         -
    #[allow(unused_mut)]
         229  +
    #[::tracing_test::traced_test]
  229    230   
    async fn rest_json_http_prefix_headers_are_present_request() {
  230    231   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  231    232   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  232    233   
  233    234   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  234    235   
        let result = client
  235    236   
            .http_prefix_headers()
  236    237   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  237    238   
            .set_foo_map(::std::option::Option::Some({
  238    239   
                let mut ret = ::std::collections::HashMap::new();
  239    240   
                ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
  240    241   
                ret.insert("Def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
  241    242   
                ret
  242    243   
            }))
  243    244   
            .send()
  244    245   
            .await;
  245    246   
        let _ = dbg!(result);
  246    247   
        let http_request = request_receiver.expect_request();
  247    248   
        let expected_headers = [("X-Foo", "Foo"), ("X-Foo-Abc", "Abc value"), ("X-Foo-Def", "Def value")];
  248    249   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  249    250   
        let body = http_request.body().bytes().expect("body should be strict");
  250    251   
        // No body
  251    252   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  252    253   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  253    254   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  254    255   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
  255    256   
    }
  256    257   
    /// No prefix headers are serialized because the value is empty
  257    258   
    /// Test ID: RestJsonHttpPrefixHeadersAreNotPresent
  258    259   
    #[::tokio::test]
  259         -
    #[allow(unused_mut)]
         260  +
    #[::tracing_test::traced_test]
  260    261   
    async fn rest_json_http_prefix_headers_are_not_present_request() {
  261    262   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  262    263   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  263    264   
  264    265   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  265    266   
        let result = client
  266    267   
            .http_prefix_headers()
  267    268   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  268    269   
            .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
  269    270   
            .send()
  270    271   
            .await;
  271    272   
        let _ = dbg!(result);
  272    273   
        let http_request = request_receiver.expect_request();
  273    274   
        let expected_headers = [("X-Foo", "Foo")];
  274    275   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  275    276   
        let body = http_request.body().bytes().expect("body should be strict");
  276    277   
        // No body
  277    278   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  278    279   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  279    280   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  280    281   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
  281    282   
    }
  282    283   
    /// Adds headers by prefix
  283    284   
    /// Test ID: RestJsonHttpPrefixHeadersArePresent
  284    285   
    #[::tokio::test]
  285         -
    #[allow(unused_mut)]
         286  +
    #[::tracing_test::traced_test]
  286    287   
    async fn rest_json_http_prefix_headers_are_present_response() {
  287    288   
        let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
  288    289   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  289    290   
            .set_foo_map(::std::option::Option::Some({
  290    291   
                let mut ret = ::std::collections::HashMap::new();
  291    292   
                ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
  292    293   
                ret.insert("Def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
  293    294   
                ret
  294    295   
            }))
  295    296   
            .build();

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

@@ -193,193 +257,258 @@
  213    213   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  214    214   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  215    215   
        })?;
  216    216   
        cfg.interceptor_state()
  217    217   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  218    218   
        ::std::result::Result::Ok(())
  219    219   
    }
  220    220   
}
  221    221   
#[allow(unreachable_code, unused_variables)]
  222    222   
#[cfg(test)]
  223         -
mod http_prefix_headers_in_response_request_test {
         223  +
mod http_prefix_headers_in_response_test {
         224  +
  224    225   
    /// (de)serializes all response headers
  225    226   
    /// Test ID: HttpPrefixHeadersResponse
  226    227   
    #[::tokio::test]
  227         -
    #[allow(unused_mut)]
         228  +
    #[::tracing_test::traced_test]
  228    229   
    async fn http_prefix_headers_response_response() {
  229    230   
        let expected_output = crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput::builder()
  230    231   
            .set_prefix_headers(::std::option::Option::Some({
  231    232   
                let mut ret = ::std::collections::HashMap::new();
  232    233   
                ret.insert("X-Foo".to_owned().to_ascii_lowercase(), "Foo".to_owned());
  233    234   
                ret.insert("Hello".to_owned().to_ascii_lowercase(), "Hello".to_owned());
  234    235   
                ret
  235    236   
            }))
  236    237   
            .build();
  237    238   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(

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

@@ -217,217 +337,338 @@
  237    237   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  238    238   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  239    239   
        })?;
  240    240   
        cfg.interceptor_state()
  241    241   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  242    242   
        ::std::result::Result::Ok(())
  243    243   
    }
  244    244   
}
  245    245   
#[allow(unreachable_code, unused_variables)]
  246    246   
#[cfg(test)]
  247         -
mod http_request_with_float_labels_request_test {
         247  +
mod http_request_with_float_labels_test {
         248  +
  248    249   
    /// Supports handling NaN float label values.
  249    250   
    /// Test ID: RestJsonSupportsNaNFloatLabels
  250    251   
    #[::tokio::test]
  251         -
    #[allow(unused_mut)]
         252  +
    #[::tracing_test::traced_test]
  252    253   
    async fn rest_json_supports_na_n_float_labels_request() {
  253    254   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  254    255   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  255    256   
  256    257   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  257    258   
        let result = client
  258    259   
            .http_request_with_float_labels()
  259    260   
            .set_float(::std::option::Option::Some(
  260    261   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  261    262   
            ))
  262    263   
            .set_double(::std::option::Option::Some(
  263    264   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  264    265   
            ))
  265    266   
            .send()
  266    267   
            .await;
  267    268   
        let _ = dbg!(result);
  268    269   
        let http_request = request_receiver.expect_request();
  269    270   
        let body = http_request.body().bytes().expect("body should be strict");
  270    271   
        // No body
  271    272   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  272    273   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  273    274   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  274    275   
        ::pretty_assertions::assert_eq!(uri.path(), "/FloatHttpLabels/NaN/NaN", "path was incorrect");
  275    276   
    }
  276    277   
    /// Supports handling Infinity float label values.
  277    278   
    /// Test ID: RestJsonSupportsInfinityFloatLabels
  278    279   
    #[::tokio::test]
  279         -
    #[allow(unused_mut)]
         280  +
    #[::tracing_test::traced_test]
  280    281   
    async fn rest_json_supports_infinity_float_labels_request() {
  281    282   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  282    283   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  283    284   
  284    285   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  285    286   
        let result = client
  286    287   
            .http_request_with_float_labels()
  287    288   
            .set_float(::std::option::Option::Some(
  288    289   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  289    290   
            ))
  290    291   
            .set_double(::std::option::Option::Some(
  291    292   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
  292    293   
            ))
  293    294   
            .send()
  294    295   
            .await;
  295    296   
        let _ = dbg!(result);
  296    297   
        let http_request = request_receiver.expect_request();
  297    298   
        let body = http_request.body().bytes().expect("body should be strict");
  298    299   
        // No body
  299    300   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  300    301   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  301    302   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  302    303   
        ::pretty_assertions::assert_eq!(uri.path(), "/FloatHttpLabels/Infinity/Infinity", "path was incorrect");
  303    304   
    }
  304    305   
    /// Supports handling -Infinity float label values.
  305    306   
    /// Test ID: RestJsonSupportsNegativeInfinityFloatLabels
  306    307   
    #[::tokio::test]
  307         -
    #[allow(unused_mut)]
         308  +
    #[::tracing_test::traced_test]
  308    309   
    async fn rest_json_supports_negative_infinity_float_labels_request() {
  309    310   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  310    311   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  311    312   
  312    313   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  313    314   
        let result = client
  314    315   
            .http_request_with_float_labels()
  315    316   
            .set_float(::std::option::Option::Some(
  316    317   
                <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
  317    318   
            ))

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

@@ -220,220 +284,285 @@
  240    240   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  241    241   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  242    242   
        })?;
  243    243   
        cfg.interceptor_state()
  244    244   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  245    245   
        ::std::result::Result::Ok(())
  246    246   
    }
  247    247   
}
  248    248   
#[allow(unreachable_code, unused_variables)]
  249    249   
#[cfg(test)]
  250         -
mod http_request_with_greedy_label_in_path_request_test {
         250  +
mod http_request_with_greedy_label_in_path_test {
         251  +
  251    252   
    /// Serializes greedy labels and normal labels
  252    253   
    /// Test ID: RestJsonHttpRequestWithGreedyLabelInPath
  253    254   
    #[::tokio::test]
  254         -
    #[allow(unused_mut)]
         255  +
    #[::tracing_test::traced_test]
  255    256   
    async fn rest_json_http_request_with_greedy_label_in_path_request() {
  256    257   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  257    258   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  258    259   
  259    260   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  260    261   
        let result = client
  261    262   
            .http_request_with_greedy_label_in_path()
  262    263   
            .set_foo(::std::option::Option::Some("hello/escape".to_owned()))
  263    264   
            .set_baz(::std::option::Option::Some("there/guy".to_owned()))
  264    265   
            .send()

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

@@ -299,299 +399,400 @@
  319    319   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  320    320   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  321    321   
        })?;
  322    322   
        cfg.interceptor_state()
  323    323   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  324    324   
        ::std::result::Result::Ok(())
  325    325   
    }
  326    326   
}
  327    327   
#[allow(unreachable_code, unused_variables)]
  328    328   
#[cfg(test)]
  329         -
mod http_request_with_labels_request_test {
         329  +
mod http_request_with_labels_test {
         330  +
  330    331   
    /// Sends a GET request that uses URI label bindings
  331    332   
    /// Test ID: RestJsonInputWithHeadersAndAllParams
  332    333   
    #[::tokio::test]
  333         -
    #[allow(unused_mut)]
         334  +
    #[::tracing_test::traced_test]
  334    335   
    async fn rest_json_input_with_headers_and_all_params_request() {
  335    336   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  336    337   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  337    338   
  338    339   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  339    340   
        let result = client
  340    341   
            .http_request_with_labels()
  341    342   
            .set_string(::std::option::Option::Some("string".to_owned()))
  342    343   
            .set_short(::std::option::Option::Some(1))
  343    344   
            .set_integer(::std::option::Option::Some(2))
  344    345   
            .set_long(::std::option::Option::Some(3))
  345    346   
            .set_float(::std::option::Option::Some(4.1_f32))
  346    347   
            .set_double(::std::option::Option::Some(5.1_f64))
  347    348   
            .set_boolean(::std::option::Option::Some(true))
  348    349   
            .set_timestamp(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  349    350   
                1576540098, 0_f64,
  350    351   
            )))
  351    352   
            .send()
  352    353   
            .await;
  353    354   
        let _ = dbg!(result);
  354    355   
        let http_request = request_receiver.expect_request();
  355    356   
        let body = http_request.body().bytes().expect("body should be strict");
  356    357   
        // No body
  357    358   
        ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
  358    359   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  359    360   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  360    361   
        ::pretty_assertions::assert_eq!(
  361    362   
            uri.path(),
  362    363   
            "/HttpRequestWithLabels/string/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z",
  363    364   
            "path was incorrect"
  364    365   
        );
  365    366   
    }
  366    367   
    /// Sends a GET request that uses URI label bindings
  367    368   
    /// Test ID: RestJsonHttpRequestLabelEscaping
  368    369   
    #[::tokio::test]
  369         -
    #[allow(unused_mut)]
         370  +
    #[::tracing_test::traced_test]
  370    371   
    async fn rest_json_http_request_label_escaping_request() {
  371    372   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  372    373   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  373    374   
  374    375   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  375    376   
        let result = client
  376    377   
            .http_request_with_labels()
  377    378   
            .set_string(::std::option::Option::Some(" %:/?#[]@!$&'()*+,;=😹".to_owned()))
  378    379   
            .set_short(::std::option::Option::Some(1))
  379    380   
            .set_integer(::std::option::Option::Some(2))

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

@@ -274,274 +338,339 @@
  294    294   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  295    295   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  296    296   
        })?;
  297    297   
        cfg.interceptor_state()
  298    298   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  299    299   
        ::std::result::Result::Ok(())
  300    300   
    }
  301    301   
}
  302    302   
#[allow(unreachable_code, unused_variables)]
  303    303   
#[cfg(test)]
  304         -
mod http_request_with_labels_and_timestamp_format_request_test {
         304  +
mod http_request_with_labels_and_timestamp_format_test {
         305  +
  305    306   
    /// Serializes different timestamp formats in URI labels
  306    307   
    /// Test ID: RestJsonHttpRequestWithLabelsAndTimestampFormat
  307    308   
    #[::tokio::test]
  308         -
    #[allow(unused_mut)]
         309  +
    #[::tracing_test::traced_test]
  309    310   
    async fn rest_json_http_request_with_labels_and_timestamp_format_request() {
  310    311   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  311    312   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  312    313   
  313    314   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  314    315   
        let result = client
  315    316   
            .http_request_with_labels_and_timestamp_format()
  316    317   
            .set_member_epoch_seconds(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  317    318   
                1576540098, 0_f64,
  318    319   
            )))

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

@@ -204,204 +268,269 @@
  224    224   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  225    225   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  226    226   
        })?;
  227    227   
        cfg.interceptor_state()
  228    228   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  229    229   
        ::std::result::Result::Ok(())
  230    230   
    }
  231    231   
}
  232    232   
#[allow(unreachable_code, unused_variables)]
  233    233   
#[cfg(test)]
  234         -
mod http_request_with_regex_literal_request_test {
         234  +
mod http_request_with_regex_literal_test {
         235  +
  235    236   
    /// Path matching is not broken by regex expressions in literal segments
  236    237   
    /// Test ID: RestJsonToleratesRegexCharsInSegments
  237    238   
    #[::tokio::test]
  238         -
    #[allow(unused_mut)]
         239  +
    #[::tracing_test::traced_test]
  239    240   
    async fn rest_json_tolerates_regex_chars_in_segments_request() {
  240    241   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  241    242   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  242    243   
  243    244   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  244    245   
        let result = client
  245    246   
            .http_request_with_regex_literal()
  246    247   
            .set_str(::std::option::Option::Some("abc".to_owned()))
  247    248   
            .send()
  248    249   
            .await;