204 204 | }
|
205 205 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
206 206 | }
|
207 207 | }
|
208 208 | #[derive(Debug)]
|
209 209 | struct NonQueryCompatibleOperationEndpointParamsInterceptor;
|
210 210 |
|
211 211 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NonQueryCompatibleOperationEndpointParamsInterceptor {
|
212 212 | fn name(&self) -> &'static str {
|
213 213 | "NonQueryCompatibleOperationEndpointParamsInterceptor"
|
214 214 | }
|
215 215 |
|
216 216 | fn read_before_execution(
|
217 217 | &self,
|
218 218 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
219 219 | '_,
|
220 220 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
221 221 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
222 222 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
223 223 | >,
|
224 224 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
225 225 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
226 226 | let _input = context
|
227 227 | .input()
|
228 228 | .downcast_ref::<NonQueryCompatibleOperationInput>()
|
229 229 | .ok_or("failed to downcast to NonQueryCompatibleOperationInput")?;
|
230 230 |
|
231 231 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
232 232 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
233 233 | })?;
|
234 + |
|
234 235 | cfg.interceptor_state()
|
235 236 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
237 + |
|
236 238 | ::std::result::Result::Ok(())
|
237 239 | }
|
238 240 | }
|
239 241 |
|
240 242 | // The get_* functions below are generated from JMESPath expressions in the
|
241 243 | // operationContextParams trait. They target the operation's input shape.
|
242 244 |
|
243 245 | #[allow(unreachable_code, unused_variables)]
|
244 246 | #[cfg(test)]
|
245 247 | mod non_query_compatible_operation_test {
|
246 248 |
|
247 249 | /// The query mode header MUST NOT be set on non-query-compatible services.
|
248 250 | /// Test ID: NonQueryCompatibleRpcV2CborForbidsQueryModeHeader
|
249 251 | #[::tokio::test]
|
250 252 | #[::tracing_test::traced_test]
|
251 253 | async fn non_query_compatible_rpc_v2_cbor_forbids_query_mode_header_request() {
|
252 254 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
253 255 | let config_builder = crate::config::Config::builder()
|
254 256 | .with_test_defaults()
|
255 257 | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
256 258 | .endpoint_url("https://example.com");
|
257 259 |
|
258 260 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
259 261 | let result = client.non_query_compatible_operation().send().await;
|
260 262 | let _ = dbg!(result);
|
261 263 | let http_request = request_receiver.expect_request();
|
262 264 | let expected_headers = [("Accept", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
|
263 265 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
264 266 | let forbidden_headers = &["x-amzn-query-mode"];
|
265 267 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
|