176 176 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
177 177 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
178 178 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
179 179 | let input = input
|
180 180 | .downcast::<crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput>()
|
181 181 | .expect("correct type");
|
182 182 | let _header_serialization_settings = _cfg
|
183 183 | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
184 184 | .cloned()
|
185 185 | .unwrap_or_default();
|
186 186 | let mut request_builder = {
|
187 187 | #[allow(clippy::uninlined_format_args)]
|
188 188 | fn uri_base(
|
189 189 | _input: &crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput,
|
190 190 | output: &mut ::std::string::String,
|
191 191 | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
192 192 | use ::std::fmt::Write as _;
|
193 193 | ::std::write!(output, "/service/RpcV2CborService/operation/StreamingOperationWithOptionalData").expect("formatting should succeed");
|
194 194 | ::std::result::Result::Ok(())
|
195 195 | }
|
196 196 | #[allow(clippy::unnecessary_wraps)]
|
197 197 | fn update_http_builder(
|
198 198 | input: &crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput,
|
199 199 | builder: ::http::request::Builder,
|
200 200 | ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
201 201 | let mut uri = ::std::string::String::new();
|
202 202 | uri_base(input, &mut uri)?;
|
203 203 | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
204 204 | }
|
205 205 | let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
|
206 - | builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
|
206 + | builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
|
207 207 | builder =
|
208 208 | _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
|
209 - | builder =
|
210 - | _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
|
209 + | builder = _header_serialization_settings.set_default_header(
|
210 + | builder,
|
211 + | ::http::header::HeaderName::from_static("accept"),
|
212 + | "application/vnd.amazon.eventstream, application/cbor",
|
213 + | );
|
211 214 | builder
|
212 215 | };
|
213 216 | let body = ::aws_smithy_types::body::SdkBody::from({
|
214 217 | let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
|
215 218 | let marshaller = crate::event_stream_serde::EventsMarshaller::new();
|
216 219 | let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
|
217 220 | _cfg.interceptor_state().store_put(signer_sender);
|
218 221 | ::aws_smithy_types::body::SdkBody::from_body_0_4(::hyper::Body::wrap_stream({
|
219 222 | use ::futures_util::StreamExt;
|
220 223 | let body =
|
221 224 | crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_input(&input)?;
|
222 225 | let initial_message = crate::event_stream_serde::initial_message_from_body(body);
|
223 226 | let mut buffer = ::std::vec::Vec::new();
|
224 227 | ::aws_smithy_eventstream::frame::write_message_to(&initial_message, &mut buffer)?;
|
225 228 | let initial_message_stream = futures_util::stream::iter(vec![Ok(buffer.into())]);
|
226 229 | let adapter = input.events.into_body_stream(marshaller, error_marshaller, signer);
|
227 230 | initial_message_stream.chain(adapter)
|
228 231 | }))
|
229 232 | });
|
230 233 | if let Some(content_length) = body.content_length() {
|
231 234 | let content_length = content_length.to_string();
|
232 235 | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
|
233 236 | }
|
234 237 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
235 238 | }
|
236 239 | }
|
237 240 | #[derive(Debug)]
|
238 241 | struct StreamingOperationWithOptionalDataEndpointParamsInterceptor;
|
239 242 |
|
240 243 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StreamingOperationWithOptionalDataEndpointParamsInterceptor {
|