Client Test

Client Test

rev. a569554406a2d90b909da823c2a673d4e4205417 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/query-compat-test/rust-client-codegen/src/operation/operation.rs

@@ -148,148 +207,209 @@
  168    168   
                uri_base(input, &mut uri)?;
  169    169   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  170    170   
            }
  171    171   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  172    172   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  173    173   
            builder = _header_serialization_settings.set_default_header(
  174    174   
                builder,
  175    175   
                ::http::header::HeaderName::from_static("x-amz-target"),
  176    176   
                "QueryCompatService.Operation",
  177    177   
            );
         178  +
            builder =
         179  +
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("x-amzn-query-mode"), "true");
  178    180   
            builder
  179    181   
        };
  180    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
  181    183   
        if let Some(content_length) = body.content_length() {
  182    184   
            let content_length = content_length.to_string();
  183    185   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  184    186   
        }
  185    187   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  186    188   
    }
  187    189   
}
@@ -212,214 +272,274 @@
  232    234   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  233    235   
  234    236   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  235    237   
        let result = client
  236    238   
            .operation()
  237    239   
            .set_message(::std::option::Option::Some("hello!".to_owned()))
  238    240   
            .send()
  239    241   
            .await;
  240    242   
        let _ = dbg!(result);
  241    243   
        let http_request = request_receiver.expect_request();
  242         -
        let expected_headers = [("x-amz-target", "QueryCompatService.Operation")];
         244  +
        let expected_headers = [("x-amz-target", "QueryCompatService.Operation"), ("x-amzn-query-mode", "true")];
  243    245   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  244    246   
        let body = http_request.body().bytes().expect("body should be strict");
  245    247   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  246    248   
            body,
  247    249   
            "{\"message\":\"hello!\"}",
  248    250   
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  249    251   
        ));
  250    252   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  251    253   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  252    254   
        ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");