221 221 | _ => crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::generic(generic),
|
222 222 | })
|
223 223 | }
|
224 224 |
|
225 225 | pub fn ser_invoke_model_with_response_stream_headers(
|
226 226 | input: &crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamInput,
|
227 227 | mut builder: ::http::request::Builder,
|
228 228 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
229 229 | if let ::std::option::Option::Some(inner_1) = &input.content_type {
|
230 230 | let formatted_2 = inner_1.as_str();
|
231 + | if !formatted_2.is_empty() {
|
231 232 | let header_value = formatted_2;
|
232 233 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
233 234 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
234 235 | "content_type",
|
235 236 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
236 237 | )
|
237 238 | })?;
|
238 239 | builder = builder.header("Content-Type", header_value);
|
239 240 | }
|
241 + | }
|
240 242 | if let ::std::option::Option::Some(inner_3) = &input.accept {
|
241 243 | let formatted_4 = inner_3.as_str();
|
244 + | if !formatted_4.is_empty() {
|
242 245 | let header_value = formatted_4;
|
243 246 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
244 247 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
245 248 | "accept",
|
246 249 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
247 250 | )
|
248 251 | })?;
|
249 252 | builder = builder.header("X-Amzn-Bedrock-Accept", header_value);
|
250 253 | }
|
254 + | }
|
251 255 | if let ::std::option::Option::Some(inner_5) = &input.trace {
|
252 256 | let formatted_6 = inner_5.as_str();
|
257 + | if !formatted_6.is_empty() {
|
253 258 | let header_value = formatted_6;
|
254 259 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
255 260 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
256 261 | "trace",
|
257 262 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
258 263 | )
|
259 264 | })?;
|
260 265 | builder = builder.header("X-Amzn-Bedrock-Trace", header_value);
|
261 266 | }
|
267 + | }
|
262 268 | if let ::std::option::Option::Some(inner_7) = &input.guardrail_identifier {
|
263 269 | let formatted_8 = inner_7.as_str();
|
270 + | if !formatted_8.is_empty() {
|
264 271 | let header_value = formatted_8;
|
265 272 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
266 273 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
267 274 | "guardrail_identifier",
|
268 275 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
269 276 | )
|
270 277 | })?;
|
271 278 | builder = builder.header("X-Amzn-Bedrock-GuardrailIdentifier", header_value);
|
272 279 | }
|
280 + | }
|
273 281 | if let ::std::option::Option::Some(inner_9) = &input.guardrail_version {
|
274 282 | let formatted_10 = inner_9.as_str();
|
283 + | if !formatted_10.is_empty() {
|
275 284 | let header_value = formatted_10;
|
276 285 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
277 286 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
278 287 | "guardrail_version",
|
279 288 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
280 289 | )
|
281 290 | })?;
|
282 291 | builder = builder.header("X-Amzn-Bedrock-GuardrailVersion", header_value);
|
283 292 | }
|
293 + | }
|
284 294 | Ok(builder)
|
285 295 | }
|