Client Test

Client Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/operation/do_nothing.rs

@@ -149,149 +219,219 @@
  169    169   
                _input: &crate::operation::do_nothing::DoNothingInput,
  170    170   
                output: &mut ::std::string::String,
  171    171   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                use ::std::fmt::Write as _;
  173    173   
                ::std::write!(output, "/").expect("formatting should succeed");
  174    174   
                ::std::result::Result::Ok(())
  175    175   
            }
  176    176   
            #[allow(clippy::unnecessary_wraps)]
  177    177   
            fn update_http_builder(
  178    178   
                input: &crate::operation::do_nothing::DoNothingInput,
  179         -
                builder: ::http::request::Builder,
  180         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         179  +
                builder: ::http_1x::request::Builder,
         180  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181    181   
                let mut uri = ::std::string::String::new();
  182    182   
                uri_base(input, &mut uri)?;
  183    183   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  184    184   
            }
  185         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
         185  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         186  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  187    187   
            builder = _header_serialization_settings.set_default_header(
  188    188   
                builder,
  189         -
                ::http::header::HeaderName::from_static("x-amz-target"),
         189  +
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  190    190   
                "PokemonService.DoNothing",
  191    191   
            );
  192    192   
            builder
  193    193   
        };
  194    194   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_do_nothing::ser_do_nothing_input(&input)?);
  195    195   
  196    196   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  197    197   
    }
  198    198   
}
  199    199   
#[derive(Debug)]

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/operation/get_server_statistics.rs

@@ -157,157 +227,227 @@
  177    177   
                _input: &crate::operation::get_server_statistics::GetServerStatisticsInput,
  178    178   
                output: &mut ::std::string::String,
  179    179   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180    180   
                use ::std::fmt::Write as _;
  181    181   
                ::std::write!(output, "/").expect("formatting should succeed");
  182    182   
                ::std::result::Result::Ok(())
  183    183   
            }
  184    184   
            #[allow(clippy::unnecessary_wraps)]
  185    185   
            fn update_http_builder(
  186    186   
                input: &crate::operation::get_server_statistics::GetServerStatisticsInput,
  187         -
                builder: ::http::request::Builder,
  188         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         187  +
                builder: ::http_1x::request::Builder,
         188  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189    189   
                let mut uri = ::std::string::String::new();
  190    190   
                uri_base(input, &mut uri)?;
  191    191   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192    192   
            }
  193         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
         193  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         194  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  195    195   
            builder = _header_serialization_settings.set_default_header(
  196    196   
                builder,
  197         -
                ::http::header::HeaderName::from_static("x-amz-target"),
         197  +
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  198    198   
                "PokemonService.GetServerStatistics",
  199    199   
            );
  200    200   
            builder
  201    201   
        };
  202    202   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_get_server_statistics::ser_get_server_statistics_input(
  203    203   
            &input,
  204    204   
        )?);
  205    205   
  206    206   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  207    207   
    }

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/serialization_settings.rs

@@ -1,1 +78,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/*
    3      3   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4      4   
 * SPDX-License-Identifier: Apache-2.0
    5      5   
 */
    6      6   
    7      7   
#![allow(dead_code)]
    8      8   
    9      9   
use aws_smithy_http::header::set_request_header_if_absent;
   10     10   
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
          11  +
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12     12   
   13     13   
/// Configuration for how default protocol headers are serialized
   14     14   
#[derive(Clone, Debug, Default)]
   15     15   
pub(crate) struct HeaderSerializationSettings {
   16     16   
    omit_default_content_length: bool,
   17     17   
    omit_default_content_type: bool,
   18     18   
}
   19     19   
   20     20   
impl HeaderSerializationSettings {
   21     21   
    /// Creates new [`HeaderSerializationSettings`]
   22     22   
    pub(crate) fn new() -> Self {
   23     23   
        Default::default()
   24     24   
    }
   25     25   
   26     26   
    /// Omit the default `Content-Length` header during serialization
   27     27   
    pub(crate) fn omit_default_content_length(self) -> Self {
   28     28   
        Self {
   29     29   
            omit_default_content_length: true,
   30     30   
            ..self
   31     31   
        }
   32     32   
    }
   33     33   
   34     34   
    /// Omit the default `Content-Type` header during serialization
   35     35   
    pub(crate) fn omit_default_content_type(self) -> Self {
   36     36   
        Self {
   37     37   
            omit_default_content_type: true,
   38     38   
            ..self
   39     39   
        }
   40     40   
    }
   41     41   
   42     42   
    /// Returns true if the given default header name should be serialized
   43     43   
    fn include_header(&self, header: &HeaderName) -> bool {
   44     44   
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45     45   
    }
   46     46   
   47     47   
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(&self, mut request: http::request::Builder, header_name: HeaderName, value: &str) -> http::request::Builder {
          48  +
    pub(crate) fn set_default_header(
          49  +
        &self,
          50  +
        mut request: http_1x::request::Builder,
          51  +
        header_name: HeaderName,
          52  +
        value: &str,
          53  +
    ) -> http_1x::request::Builder {
   49     54   
        if self.include_header(&header_name) {
   50     55   
            request = set_request_header_if_absent(request, header_name, value);
   51     56   
        }
   52     57   
        request
   53     58   
    }
   54     59   
}
   55     60   
   56     61   
impl Storable for HeaderSerializationSettings {
   57     62   
    type Storer = StoreReplace<Self>;
   58     63   
}

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/Cargo.toml

@@ -1,1 +50,53 @@
   16     16   
[dependencies.aws-smithy-http]
   17     17   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   18     18   
features = ["event-stream"]
   19     19   
[dependencies.aws-smithy-json]
   20     20   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
   21     21   
[dependencies.aws-smithy-runtime]
   22     22   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime"
   23     23   
features = ["client"]
   24     24   
[dependencies.aws-smithy-runtime-api]
   25     25   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
   26         -
features = ["client", "http-02x"]
          26  +
features = ["client", "http-1x"]
   27     27   
[dependencies.aws-smithy-types]
   28     28   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
   29         -
features = ["http-body-0-4-x"]
          29  +
features = ["http-body-1-x", "http-body-0-4-x"]
   30     30   
[dependencies.bytes]
   31     31   
version = "1.4.0"
   32     32   
[dependencies.fastrand]
   33     33   
version = "2.0.0"
   34     34   
[dependencies.http]
   35     35   
version = "0.2.9"
          36  +
[dependencies.http-1x]
          37  +
version = "1"
          38  +
package = "http"
   36     39   
[dependencies.hyper]
   37     40   
version = "0.14.26"
   38     41   
features = ["stream"]
   39     42   
[dependencies.tracing]
   40     43   
version = "0.1"
   41     44   
[features]
   42     45   
test-util = ["aws-smithy-runtime/test-util"]
   43         -
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
          46  +
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/http-body-1-x", "aws-smithy-types/rt-tokio"]
   44     47   
behavior-version-latest = []
   45     48   
rustls = ["aws-smithy-runtime/tls-rustls"]
   46     49   
default-https-client = ["aws-smithy-runtime/default-https-client"]
   47     50   
gated-tests = []
   48     51   
default = ["rt-tokio", "rustls", "default-https-client"]
   49     52   
   50     53   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/json_errors.rs

@@ -1,1 +45,45 @@
    5      5   
 */
    6      6   
    7      7   
use aws_smithy_json::deserialize::token::skip_value;
    8      8   
use aws_smithy_json::deserialize::{error::DeserializeError, json_token_iter, Token};
    9      9   
use aws_smithy_runtime_api::http::Headers;
   10     10   
use aws_smithy_types::error::metadata::{Builder as ErrorMetadataBuilder, ErrorMetadata};
   11     11   
use std::borrow::Cow;
   12     12   
   13     13   
// currently only used by AwsJson
   14     14   
#[allow(unused)]
   15         -
pub fn is_error<B>(response: &http::Response<B>) -> bool {
          15  +
pub fn is_error<B>(response: &http_1x::Response<B>) -> bool {
   16     16   
    !response.status().is_success()
   17     17   
}
   18     18   
   19     19   
fn sanitize_error_code(error_code: &str) -> &str {
   20     20   
    // Trim a trailing URL from the error code, which is done by removing the longest suffix
   21     21   
    // beginning with a `:`
   22     22   
    let error_code = match error_code.find(':') {
   23     23   
        Some(idx) => &error_code[..idx],
   24     24   
        None => error_code,
   25     25   
    };
@@ -60,60 +120,120 @@
   80     80   
#[cfg(test)]
   81     81   
mod test {
   82     82   
    use crate::json_errors::{parse_error_body, parse_error_metadata, sanitize_error_code};
   83     83   
    use aws_smithy_runtime_api::client::orchestrator::HttpResponse;
   84     84   
    use aws_smithy_types::{body::SdkBody, error::ErrorMetadata};
   85     85   
    use std::borrow::Cow;
   86     86   
   87     87   
    #[test]
   88     88   
    fn error_metadata() {
   89     89   
        let response = HttpResponse::try_from(
   90         -
            http::Response::builder()
          90  +
            http_1x::Response::builder()
   91     91   
                .body(SdkBody::from(r#"{ "__type": "FooError", "message": "Go to foo" }"#))
   92     92   
                .unwrap(),
   93     93   
        )
   94     94   
        .unwrap();
   95     95   
        assert_eq!(
   96     96   
            parse_error_metadata(response.body().bytes().unwrap(), response.headers())
   97     97   
                .unwrap()
   98     98   
                .build(),
   99     99   
            ErrorMetadata::builder().code("FooError").message("Go to foo").build()
  100    100   
        )
@@ -129,129 +180,180 @@
  149    149   
  150    150   
    #[test]
  151    151   
    fn sanitize_namespace() {
  152    152   
        assert_eq!(sanitize_error_code("aws.protocoltests.restjson#FooError"), "FooError");
  153    153   
    }
  154    154   
  155    155   
    // services like lambda use an alternate `Message` instead of `message`
  156    156   
    #[test]
  157    157   
    fn alternative_error_message_names() {
  158    158   
        let response = HttpResponse::try_from(
  159         -
            http::Response::builder()
         159  +
            http_1x::Response::builder()
  160    160   
                .header("x-amzn-errortype", "ResourceNotFoundException")
  161    161   
                .body(SdkBody::from(
  162    162   
                    r#"{
  163    163   
                    "Type": "User",
  164    164   
                    "Message": "Functions from 'us-west-2' are not reachable from us-east-1"
  165    165   
                }"#,
  166    166   
                ))
  167    167   
                .unwrap(),
  168    168   
        )
  169    169   
        .unwrap();

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/capture_pokemon.rs

@@ -172,172 +255,256 @@
  192    192   
                        "region",
  193    193   
                        "cannot be empty or unset",
  194    194   
                    ));
  195    195   
                }
  196    196   
                ::std::write!(output, "/capture-pokemon-event/{region}", region = region).expect("formatting should succeed");
  197    197   
                ::std::result::Result::Ok(())
  198    198   
            }
  199    199   
            #[allow(clippy::unnecessary_wraps)]
  200    200   
            fn update_http_builder(
  201    201   
                input: &crate::operation::capture_pokemon::CapturePokemonInput,
  202         -
                builder: ::http::request::Builder,
  203         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         202  +
                builder: ::http_1x::request::Builder,
         203  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  204    204   
                let mut uri = ::std::string::String::new();
  205    205   
                uri_base(input, &mut uri)?;
  206    206   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  207    207   
            }
  208         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  209         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
         208  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         209  +
            builder =
         210  +
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
  210    211   
            builder
  211    212   
        };
  212    213   
        let body = ::aws_smithy_types::body::SdkBody::from({
  213    214   
            let error_marshaller = crate::event_stream_serde::AttemptCapturingPokemonEventErrorMarshaller::new();
  214    215   
            let marshaller = crate::event_stream_serde::AttemptCapturingPokemonEventMarshaller::new();
  215    216   
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
  216    217   
            _cfg.interceptor_state().store_put(signer_sender);
  217    218   
            ::aws_smithy_types::body::SdkBody::from_body_0_4(::hyper::Body::wrap_stream(input.events.into_body_stream(
  218    219   
                marshaller,
  219    220   
                error_marshaller,
  220    221   
                signer,
  221    222   
            )))
  222    223   
        });
  223    224   
        if let Some(content_length) = body.content_length() {
  224    225   
            let content_length = content_length.to_string();
  225         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         226  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  226    227   
        }
  227    228   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  228    229   
    }
  229    230   
}
  230    231   
#[derive(Debug)]
  231    232   
struct CapturePokemonEndpointParamsInterceptor;
  232    233   
  233    234   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CapturePokemonEndpointParamsInterceptor {
  234    235   
    fn name(&self) -> &'static str {
  235    236   
        "CapturePokemonEndpointParamsInterceptor"

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/check_health.rs

@@ -151,151 +217,217 @@
  171    171   
                _input: &crate::operation::check_health::CheckHealthInput,
  172    172   
                output: &mut ::std::string::String,
  173    173   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174    174   
                use ::std::fmt::Write as _;
  175    175   
                ::std::write!(output, "/ping").expect("formatting should succeed");
  176    176   
                ::std::result::Result::Ok(())
  177    177   
            }
  178    178   
            #[allow(clippy::unnecessary_wraps)]
  179    179   
            fn update_http_builder(
  180    180   
                input: &crate::operation::check_health::CheckHealthInput,
  181         -
                builder: ::http::request::Builder,
  182         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         181  +
                builder: ::http_1x::request::Builder,
         182  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183    183   
                let mut uri = ::std::string::String::new();
  184    184   
                uri_base(input, &mut uri)?;
  185    185   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  186    186   
            }
  187         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         187  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188    188   
            builder
  189    189   
        };
  190    190   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  191    191   
  192    192   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  193    193   
    }
  194    194   
}
  195    195   
#[derive(Debug)]
  196    196   
struct CheckHealthEndpointParamsInterceptor;
  197    197   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/do_nothing.rs

@@ -149,149 +215,215 @@
  169    169   
                _input: &crate::operation::do_nothing::DoNothingInput,
  170    170   
                output: &mut ::std::string::String,
  171    171   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                use ::std::fmt::Write as _;
  173    173   
                ::std::write!(output, "/do-nothing").expect("formatting should succeed");
  174    174   
                ::std::result::Result::Ok(())
  175    175   
            }
  176    176   
            #[allow(clippy::unnecessary_wraps)]
  177    177   
            fn update_http_builder(
  178    178   
                input: &crate::operation::do_nothing::DoNothingInput,
  179         -
                builder: ::http::request::Builder,
  180         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         179  +
                builder: ::http_1x::request::Builder,
         180  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181    181   
                let mut uri = ::std::string::String::new();
  182    182   
                uri_base(input, &mut uri)?;
  183    183   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  184    184   
            }
  185         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         185  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186    186   
            builder
  187    187   
        };
  188    188   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  189    189   
  190    190   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  191    191   
    }
  192    192   
}
  193    193   
#[derive(Debug)]
  194    194   
struct DoNothingEndpointParamsInterceptor;
  195    195   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/get_pokemon_species.rs

@@ -162,162 +228,228 @@
  182    182   
                        "name",
  183    183   
                        "cannot be empty or unset",
  184    184   
                    ));
  185    185   
                }
  186    186   
                ::std::write!(output, "/pokemon-species/{name}", name = name).expect("formatting should succeed");
  187    187   
                ::std::result::Result::Ok(())
  188    188   
            }
  189    189   
            #[allow(clippy::unnecessary_wraps)]
  190    190   
            fn update_http_builder(
  191    191   
                input: &crate::operation::get_pokemon_species::GetPokemonSpeciesInput,
  192         -
                builder: ::http::request::Builder,
  193         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         192  +
                builder: ::http_1x::request::Builder,
         193  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  194    194   
                let mut uri = ::std::string::String::new();
  195    195   
                uri_base(input, &mut uri)?;
  196    196   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  197    197   
            }
  198         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         198  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  199    199   
            builder
  200    200   
        };
  201    201   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  202    202   
  203    203   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  204    204   
    }
  205    205   
}
  206    206   
#[derive(Debug)]
  207    207   
struct GetPokemonSpeciesEndpointParamsInterceptor;
  208    208   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/get_server_statistics.rs

@@ -157,157 +223,223 @@
  177    177   
                _input: &crate::operation::get_server_statistics::GetServerStatisticsInput,
  178    178   
                output: &mut ::std::string::String,
  179    179   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180    180   
                use ::std::fmt::Write as _;
  181    181   
                ::std::write!(output, "/stats").expect("formatting should succeed");
  182    182   
                ::std::result::Result::Ok(())
  183    183   
            }
  184    184   
            #[allow(clippy::unnecessary_wraps)]
  185    185   
            fn update_http_builder(
  186    186   
                input: &crate::operation::get_server_statistics::GetServerStatisticsInput,
  187         -
                builder: ::http::request::Builder,
  188         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         187  +
                builder: ::http_1x::request::Builder,
         188  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189    189   
                let mut uri = ::std::string::String::new();
  190    190   
                uri_base(input, &mut uri)?;
  191    191   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  192    192   
            }
  193         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         193  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194    194   
            builder
  195    195   
        };
  196    196   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  197    197   
  198    198   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  199    199   
    }
  200    200   
}
  201    201   
#[derive(Debug)]
  202    202   
struct GetServerStatisticsEndpointParamsInterceptor;
  203    203   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/get_storage.rs

@@ -160,160 +227,227 @@
  180    180   
                        "user",
  181    181   
                        "cannot be empty or unset",
  182    182   
                    ));
  183    183   
                }
  184    184   
                ::std::write!(output, "/pokedex/{user}", user = user).expect("formatting should succeed");
  185    185   
                ::std::result::Result::Ok(())
  186    186   
            }
  187    187   
            #[allow(clippy::unnecessary_wraps)]
  188    188   
            fn update_http_builder(
  189    189   
                input: &crate::operation::get_storage::GetStorageInput,
  190         -
                builder: ::http::request::Builder,
  191         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         190  +
                builder: ::http_1x::request::Builder,
         191  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  192    192   
                let mut uri = ::std::string::String::new();
  193    193   
                uri_base(input, &mut uri)?;
  194    194   
                let builder = crate::protocol_serde::shape_get_storage::ser_get_storage_headers(input, builder)?;
  195    195   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  196    196   
            }
  197         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         197  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  198    198   
            builder
  199    199   
        };
  200    200   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  201    201   
  202    202   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  203    203   
    }
  204    204   
}
  205    205   
#[derive(Debug)]
  206    206   
struct GetStorageEndpointParamsInterceptor;
  207    207   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/stream_pokemon_radio.rs

@@ -162,162 +228,228 @@
  182    182   
                _input: &crate::operation::stream_pokemon_radio::StreamPokemonRadioInput,
  183    183   
                output: &mut ::std::string::String,
  184    184   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  185    185   
                use ::std::fmt::Write as _;
  186    186   
                ::std::write!(output, "/radio").expect("formatting should succeed");
  187    187   
                ::std::result::Result::Ok(())
  188    188   
            }
  189    189   
            #[allow(clippy::unnecessary_wraps)]
  190    190   
            fn update_http_builder(
  191    191   
                input: &crate::operation::stream_pokemon_radio::StreamPokemonRadioInput,
  192         -
                builder: ::http::request::Builder,
  193         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         192  +
                builder: ::http_1x::request::Builder,
         193  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  194    194   
                let mut uri = ::std::string::String::new();
  195    195   
                uri_base(input, &mut uri)?;
  196    196   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  197    197   
            }
  198         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         198  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  199    199   
            builder
  200    200   
        };
  201    201   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  202    202   
  203    203   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  204    204   
    }
  205    205   
}
  206    206   
#[derive(Debug)]
  207    207   
struct StreamPokemonRadioEndpointParamsInterceptor;
  208    208   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/protocol_serde/shape_get_storage.rs

@@ -56,56 +121,121 @@
   76     76   
        output = crate::protocol_serde::shape_get_storage::de_get_storage(_response_body, output)
   77     77   
            .map_err(crate::operation::get_storage::GetStorageError::unhandled)?;
   78     78   
        crate::serde_util::get_storage_output_output_correct_errors(output)
   79     79   
            .build()
   80     80   
            .map_err(crate::operation::get_storage::GetStorageError::unhandled)?
   81     81   
    })
   82     82   
}
   83     83   
   84     84   
pub fn ser_get_storage_headers(
   85     85   
    input: &crate::operation::get_storage::GetStorageInput,
   86         -
    mut builder: ::http::request::Builder,
   87         -
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          86  +
    mut builder: ::http_1x::request::Builder,
          87  +
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   88     88   
    if let ::std::option::Option::Some(inner_1) = &input.passcode {
   89     89   
        let formatted_2 = inner_1.as_str();
   90     90   
        let header_value = formatted_2;
   91         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          91  +
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   92     92   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   93     93   
                "passcode",
   94     94   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   95     95   
            )
   96     96   
        })?;
   97     97   
        builder = builder.header("passcode", header_value);
   98     98   
    }
   99     99   
    Ok(builder)
  100    100   
}
  101    101   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/serialization_settings.rs

@@ -1,1 +78,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/*
    3      3   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4      4   
 * SPDX-License-Identifier: Apache-2.0
    5      5   
 */
    6      6   
    7      7   
#![allow(dead_code)]
    8      8   
    9      9   
use aws_smithy_http::header::set_request_header_if_absent;
   10     10   
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
          11  +
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12     12   
   13     13   
/// Configuration for how default protocol headers are serialized
   14     14   
#[derive(Clone, Debug, Default)]
   15     15   
pub(crate) struct HeaderSerializationSettings {
   16     16   
    omit_default_content_length: bool,
   17     17   
    omit_default_content_type: bool,
   18     18   
}
   19     19   
   20     20   
impl HeaderSerializationSettings {
   21     21   
    /// Creates new [`HeaderSerializationSettings`]
   22     22   
    pub(crate) fn new() -> Self {
   23     23   
        Default::default()
   24     24   
    }
   25     25   
   26     26   
    /// Omit the default `Content-Length` header during serialization
   27     27   
    pub(crate) fn omit_default_content_length(self) -> Self {
   28     28   
        Self {
   29     29   
            omit_default_content_length: true,
   30     30   
            ..self
   31     31   
        }
   32     32   
    }
   33     33   
   34     34   
    /// Omit the default `Content-Type` header during serialization
   35     35   
    pub(crate) fn omit_default_content_type(self) -> Self {
   36     36   
        Self {
   37     37   
            omit_default_content_type: true,
   38     38   
            ..self
   39     39   
        }
   40     40   
    }
   41     41   
   42     42   
    /// Returns true if the given default header name should be serialized
   43     43   
    fn include_header(&self, header: &HeaderName) -> bool {
   44     44   
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45     45   
    }
   46     46   
   47     47   
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(&self, mut request: http::request::Builder, header_name: HeaderName, value: &str) -> http::request::Builder {
          48  +
    pub(crate) fn set_default_header(
          49  +
        &self,
          50  +
        mut request: http_1x::request::Builder,
          51  +
        header_name: HeaderName,
          52  +
        value: &str,
          53  +
    ) -> http_1x::request::Builder {
   49     54   
        if self.include_header(&header_name) {
   50     55   
            request = set_request_header_if_absent(request, header_name, value);
   51     56   
        }
   52     57   
        request
   53     58   
    }
   54     59   
}
   55     60   
   56     61   
impl Storable for HeaderSerializationSettings {
   57     62   
    type Storer = StoreReplace<Self>;
   58     63   
}

tmp-codegen-diff/codegen-client-test/query-compat-test/rust-client-codegen/Cargo.toml

@@ -1,1 +56,60 @@
   13     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-async"
   14     14   
[dependencies.aws-smithy-http]
   15     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   16     16   
[dependencies.aws-smithy-json]
   17     17   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
   18     18   
[dependencies.aws-smithy-runtime]
   19     19   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime"
   20     20   
features = ["client"]
   21     21   
[dependencies.aws-smithy-runtime-api]
   22     22   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
   23         -
features = ["client", "http-02x"]
          23  +
features = ["client", "http-1x"]
   24     24   
[dependencies.aws-smithy-types]
   25     25   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          26  +
features = ["http-body-1-x"]
   26     27   
[dependencies.bytes]
   27     28   
version = "1.4.0"
   28     29   
[dependencies.fastrand]
   29     30   
version = "2.0.0"
   30     31   
[dependencies.http]
   31     32   
version = "0.2.9"
          33  +
[dependencies.http-1x]
          34  +
version = "1"
          35  +
package = "http"
   32     36   
[dependencies.tracing]
   33     37   
version = "0.1"
   34     38   
[dev-dependencies.aws-smithy-http-client]
   35     39   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-client"
   36     40   
features = ["test-util"]
   37     41   
[dev-dependencies.aws-smithy-protocol-test]
   38     42   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-protocol-test"
   39     43   
[dev-dependencies.pretty_assertions]
   40     44   
version = "1.3.0"
   41     45   
[dev-dependencies.tokio]

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

@@ -3,3 +71,72 @@
   23     23   
        .map(|idx| (&header_value[..idx], &header_value[idx + 1..]))
   24     24   
}
   25     25   
   26     26   
#[cfg(test)]
   27     27   
mod test {
   28     28   
    use crate::aws_query_compatible_errors::{parse_aws_query_compatible_error, X_AMZN_QUERY_ERROR};
   29     29   
    use aws_smithy_runtime_api::http::Response;
   30     30   
   31     31   
    #[test]
   32     32   
    fn parse_aws_query_compatible_error_should_parse_code_and_type_fields() {
   33         -
        let mut response: http::Response<()> = http::Response::default();
          33  +
        let mut response: http_1x::Response<()> = http_1x::Response::default();
   34     34   
        response.headers_mut().insert(
   35     35   
            X_AMZN_QUERY_ERROR,
   36         -
            http::HeaderValue::from_static("AWS.SimpleQueueService.NonExistentQueue;Sender"),
          36  +
            http_1x::HeaderValue::from_static("AWS.SimpleQueueService.NonExistentQueue;Sender"),
   37     37   
        );
   38     38   
        let response = Response::try_from(response).unwrap();
   39     39   
   40     40   
        let actual = parse_aws_query_compatible_error(response.headers());
   41     41   
   42     42   
        assert_eq!(Some(("AWS.SimpleQueueService.NonExistentQueue", "Sender")), actual,);
   43     43   
    }
   44     44   
   45     45   
    #[test]
   46     46   
    fn parse_aws_query_compatible_error_should_return_none_when_header_value_has_no_delimiter() {
   47         -
        let mut response: http::Response<()> = http::Response::default();
          47  +
        let mut response: http_1x::Response<()> = http_1x::Response::default();
   48     48   
        response.headers_mut().insert(
   49     49   
            X_AMZN_QUERY_ERROR,
   50         -
            http::HeaderValue::from_static("AWS.SimpleQueueService.NonExistentQueue"),
          50  +
            http_1x::HeaderValue::from_static("AWS.SimpleQueueService.NonExistentQueue"),
   51     51   
        );
   52     52   
        let response = Response::try_from(response).unwrap();
   53     53   
   54     54   
        let actual = parse_aws_query_compatible_error(response.headers());
   55     55   
   56     56   
        assert_eq!(None, actual);
   57     57   
    }
   58     58   
   59     59   
    #[test]
   60     60   
    fn parse_aws_query_compatible_error_should_return_none_when_there_is_no_target_header() {
   61         -
        let mut response: http::Response<()> = http::Response::default();
   62         -
        response
   63         -
            .headers_mut()
   64         -
            .insert("x-amzn-requestid", http::HeaderValue::from_static("a918fbf2-457a-4fe1-99ba-5685ce220fc1"));
          61  +
        let mut response: http_1x::Response<()> = http_1x::Response::default();
          62  +
        response.headers_mut().insert(
          63  +
            "x-amzn-requestid",
          64  +
            http_1x::HeaderValue::from_static("a918fbf2-457a-4fe1-99ba-5685ce220fc1"),
          65  +
        );
   65     66   
        let response = Response::try_from(response).unwrap();
   66     67   
   67     68   
        let actual = parse_aws_query_compatible_error(response.headers());
   68     69   
   69     70   
        assert_eq!(None, actual);
   70     71   
    }
   71     72   
}