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