208 208 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
209 209 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
210 210 | })?;
|
211 211 | cfg.interceptor_state()
|
212 212 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
213 213 | ::std::result::Result::Ok(())
|
214 214 | }
|
215 215 | }
|
216 216 | #[allow(unreachable_code, unused_variables)]
|
217 217 | #[cfg(test)]
|
218 - | mod http_prefix_headers_request_test {
|
218 + | mod http_prefix_headers_test {
|
219 + |
|
219 220 | /// Adds headers by prefix
|
220 221 | /// Test ID: HttpPrefixHeadersArePresent
|
221 222 | #[::tokio::test]
|
222 - | #[allow(unused_mut)]
|
223 + | #[::tracing_test::traced_test]
|
223 224 | async fn http_prefix_headers_are_present_request() {
|
224 225 | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
225 226 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
226 227 |
|
227 228 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
228 229 | let result = client
|
229 230 | .http_prefix_headers()
|
230 231 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
231 232 | .set_foo_map(::std::option::Option::Some({
|
232 233 | let mut ret = ::std::collections::HashMap::new();
|
233 234 | ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
|
234 235 | ret.insert("Def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
|
235 236 | ret
|
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 expected_headers = [("X-Foo", "Foo"), ("X-Foo-Abc", "Abc value"), ("X-Foo-Def", "Def value")];
|
242 243 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
243 244 | let body = http_request.body().bytes().expect("body should be strict");
|
244 245 | // No body
|
245 246 | ::pretty_assertions::assert_eq!(::std::str::from_utf8(body).unwrap(), "");
|
246 247 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
247 248 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
248 249 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
249 250 | }
|
250 251 | /// No prefix headers are serialized because the value is empty
|
251 252 | /// Test ID: HttpPrefixHeadersAreNotPresent
|
252 253 | #[::tokio::test]
|
253 - | #[allow(unused_mut)]
|
254 + | #[::tracing_test::traced_test]
|
254 255 | async fn http_prefix_headers_are_not_present_request() {
|
255 256 | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
256 257 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
257 258 |
|
258 259 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
259 260 | let result = client
|
260 261 | .http_prefix_headers()
|
261 262 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
262 263 | .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
|
263 264 | .send()
|
264 265 | .await;
|
265 266 | let _ = dbg!(result);
|
266 267 | let http_request = request_receiver.expect_request();
|
267 268 | let expected_headers = [("X-Foo", "Foo")];
|
268 269 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
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(), "/HttpPrefixHeaders", "path was incorrect");
|
275 276 | }
|
276 277 | /// Adds headers by prefix
|
277 278 | /// Test ID: HttpPrefixHeadersArePresent
|
278 279 | #[::tokio::test]
|
279 - | #[allow(unused_mut)]
|
280 + | #[::tracing_test::traced_test]
|
280 281 | async fn http_prefix_headers_are_present_response() {
|
281 282 | let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
|
282 283 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
283 284 | .set_foo_map(::std::option::Option::Some({
|
284 285 | let mut ret = ::std::collections::HashMap::new();
|
285 286 | ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
|
286 287 | ret.insert("Def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
|
287 288 | ret
|
288 289 | }))
|
289 290 | .build();
|
290 291 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
291 292 | ::http::response::Builder::new()
|
292 293 | .header("X-Foo", "Foo")
|
293 294 | .header("X-Foo-Abc", "Abc value")
|
294 295 | .header("X-Foo-Def", "Def value")
|
295 296 | .status(200)
|
296 297 | .body(::aws_smithy_types::body::SdkBody::from(""))
|
297 298 | .unwrap(),
|
298 299 | )
|
299 300 | .unwrap();
|
300 301 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
301 302 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
302 303 |
|
303 304 | let op = crate::operation::http_prefix_headers::HttpPrefixHeaders::new();
|
304 305 | let config = op.config().expect("the operation has config");
|
305 306 | let de = config
|
306 307 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
307 308 | .expect("the config must have a deserializer");
|
308 309 |
|
309 310 | let parsed = de.deserialize_streaming(&mut http_response);
|
310 311 | let parsed = parsed.unwrap_or_else(|| {
|
311 312 | let http_response =
|
312 313 | http_response.map(|body| ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(body.bytes().unwrap())));
|
313 314 | de.deserialize_nonstreaming(&http_response)
|
314 315 | });
|
315 316 | let parsed = parsed
|
316 317 | .expect("should be successful response")
|
317 318 | .downcast::<crate::operation::http_prefix_headers::HttpPrefixHeadersOutput>()
|
318 319 | .unwrap();
|
319 320 | ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
|
320 321 | ::pretty_assertions::assert_eq!(parsed.foo_map, expected_output.foo_map, "Unexpected value for `foo_map`");
|
321 322 | }
|
322 323 | /// No prefix headers are serialized because the value is empty
|
323 324 | /// Test ID: HttpPrefixHeadersAreNotPresent
|
324 325 | #[::tokio::test]
|
325 - | #[allow(unused_mut)]
|
326 + | #[::tracing_test::traced_test]
|
326 327 | async fn http_prefix_headers_are_not_present_response() {
|
327 328 | let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
|
328 329 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
329 330 | .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
|
330 331 | .build();
|
331 332 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
332 333 | ::http::response::Builder::new()
|
333 334 | .header("X-Foo", "Foo")
|
334 335 | .status(200)
|
335 336 | .body(::aws_smithy_types::body::SdkBody::from(""))
|