160 160 | output.build()
|
161 161 | })
|
162 162 | }
|
163 163 |
|
164 164 | pub fn ser_input_and_output_with_headers_headers(
|
165 165 | input: &crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersInput,
|
166 166 | mut builder: ::http::request::Builder,
|
167 167 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
168 168 | if let ::std::option::Option::Some(inner_1) = &input.header_string {
|
169 169 | let formatted_2 = inner_1.as_str();
|
170 - | let header_value = formatted_2;
|
171 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
172 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
173 - | "header_string",
|
174 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
175 - | )
|
176 - | })?;
|
177 - | builder = builder.header("X-String", header_value);
|
170 + | if !formatted_2.is_empty() {
|
171 + | let header_value = formatted_2;
|
172 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
173 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
174 + | "header_string",
|
175 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
176 + | )
|
177 + | })?;
|
178 + | builder = builder.header("X-String", header_value);
|
179 + | }
|
178 180 | }
|
179 181 | if let ::std::option::Option::Some(inner_3) = &input.header_byte {
|
180 182 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
|
181 183 | let formatted_4 = encoder.encode();
|
182 - | let header_value = formatted_4;
|
183 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
184 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 - | "header_byte",
|
186 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 - | )
|
188 - | })?;
|
189 - | builder = builder.header("X-Byte", header_value);
|
184 + | if !formatted_4.is_empty() {
|
185 + | let header_value = formatted_4;
|
186 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
187 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
188 + | "header_byte",
|
189 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
190 + | )
|
191 + | })?;
|
192 + | builder = builder.header("X-Byte", header_value);
|
193 + | }
|
190 194 | }
|
191 195 | if let ::std::option::Option::Some(inner_5) = &input.header_short {
|
192 196 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
|
193 197 | let formatted_6 = encoder.encode();
|
194 - | let header_value = formatted_6;
|
195 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
196 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
197 - | "header_short",
|
198 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
199 - | )
|
200 - | })?;
|
201 - | builder = builder.header("X-Short", header_value);
|
198 + | if !formatted_6.is_empty() {
|
199 + | let header_value = formatted_6;
|
200 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
201 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
202 + | "header_short",
|
203 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
204 + | )
|
205 + | })?;
|
206 + | builder = builder.header("X-Short", header_value);
|
207 + | }
|
202 208 | }
|
203 209 | if let ::std::option::Option::Some(inner_7) = &input.header_integer {
|
204 210 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
|
205 211 | let formatted_8 = encoder.encode();
|
206 - | let header_value = formatted_8;
|
207 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
208 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
209 - | "header_integer",
|
210 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
211 - | )
|
212 - | })?;
|
213 - | builder = builder.header("X-Integer", header_value);
|
212 + | if !formatted_8.is_empty() {
|
213 + | let header_value = formatted_8;
|
214 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
215 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
216 + | "header_integer",
|
217 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
218 + | )
|
219 + | })?;
|
220 + | builder = builder.header("X-Integer", header_value);
|
221 + | }
|
214 222 | }
|
215 223 | if let ::std::option::Option::Some(inner_9) = &input.header_long {
|
216 224 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
|
217 225 | let formatted_10 = encoder.encode();
|
218 - | let header_value = formatted_10;
|
219 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
220 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
221 - | "header_long",
|
222 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
223 - | )
|
224 - | })?;
|
225 - | builder = builder.header("X-Long", header_value);
|
226 + | if !formatted_10.is_empty() {
|
227 + | let header_value = formatted_10;
|
228 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
229 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
230 + | "header_long",
|
231 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
232 + | )
|
233 + | })?;
|
234 + | builder = builder.header("X-Long", header_value);
|
235 + | }
|
226 236 | }
|
227 237 | if let ::std::option::Option::Some(inner_11) = &input.header_float {
|
228 238 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
|
229 239 | let formatted_12 = encoder.encode();
|
230 - | let header_value = formatted_12;
|
231 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
232 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
233 - | "header_float",
|
234 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
235 - | )
|
236 - | })?;
|
237 - | builder = builder.header("X-Float", header_value);
|
240 + | if !formatted_12.is_empty() {
|
241 + | let header_value = formatted_12;
|
242 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
243 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
244 + | "header_float",
|
245 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
246 + | )
|
247 + | })?;
|
248 + | builder = builder.header("X-Float", header_value);
|
249 + | }
|
238 250 | }
|
239 251 | if let ::std::option::Option::Some(inner_13) = &input.header_double {
|
240 252 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
|
241 253 | let formatted_14 = encoder.encode();
|
242 - | let header_value = formatted_14;
|
243 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
244 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
245 - | "header_double",
|
246 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
247 - | )
|
248 - | })?;
|
249 - | builder = builder.header("X-Double", header_value);
|
254 + | if !formatted_14.is_empty() {
|
255 + | let header_value = formatted_14;
|
256 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
257 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
258 + | "header_double",
|
259 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
260 + | )
|
261 + | })?;
|
262 + | builder = builder.header("X-Double", header_value);
|
263 + | }
|
250 264 | }
|
251 265 | if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
|
252 266 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
|
253 267 | let formatted_16 = encoder.encode();
|
254 - | let header_value = formatted_16;
|
255 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
256 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
257 - | "header_true_bool",
|
258 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
259 - | )
|
260 - | })?;
|
261 - | builder = builder.header("X-Boolean1", header_value);
|
268 + | if !formatted_16.is_empty() {
|
269 + | let header_value = formatted_16;
|
270 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
271 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
272 + | "header_true_bool",
|
273 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
274 + | )
|
275 + | })?;
|
276 + | builder = builder.header("X-Boolean1", header_value);
|
277 + | }
|
262 278 | }
|
263 279 | if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
|
264 280 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
|
265 281 | let formatted_18 = encoder.encode();
|
266 - | let header_value = formatted_18;
|
267 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
268 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
269 - | "header_false_bool",
|
270 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
271 - | )
|
272 - | })?;
|
273 - | builder = builder.header("X-Boolean2", header_value);
|
282 + | if !formatted_18.is_empty() {
|
283 + | let header_value = formatted_18;
|
284 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
285 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
286 + | "header_false_bool",
|
287 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
288 + | )
|
289 + | })?;
|
290 + | builder = builder.header("X-Boolean2", header_value);
|
291 + | }
|
274 292 | }
|
275 293 | if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
|
276 - | // Empty vec in header is serialized as an empty string
|
277 - | if inner_19.is_empty() {
|
278 - | builder = builder.header("X-StringList", "");
|
279 - | } else {
|
280 - | for inner_20 in inner_19 {
|
281 - | let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
|
294 + | for inner_20 in inner_19 {
|
295 + | let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
|
296 + | if !formatted_21.is_empty() {
|
282 297 | let header_value = formatted_21;
|
283 298 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
284 299 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
285 300 | "header_string_list",
|
286 301 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
287 302 | )
|
288 303 | })?;
|
289 304 | builder = builder.header("X-StringList", header_value);
|
290 305 | }
|
291 306 | }
|
292 307 | }
|
293 308 | if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
|
294 - | // Empty vec in header is serialized as an empty string
|
295 - | if inner_22.is_empty() {
|
296 - | builder = builder.header("X-StringSet", "");
|
297 - | } else {
|
298 - | for inner_23 in inner_22 {
|
299 - | let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
|
309 + | for inner_23 in inner_22 {
|
310 + | let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
|
311 + | if !formatted_24.is_empty() {
|
300 312 | let header_value = formatted_24;
|
301 313 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
302 314 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
303 315 | "header_string_set",
|
304 316 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
305 317 | )
|
306 318 | })?;
|
307 319 | builder = builder.header("X-StringSet", header_value);
|
308 320 | }
|
309 321 | }
|
310 322 | }
|
311 323 | if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
|
312 - | // Empty vec in header is serialized as an empty string
|
313 - | if inner_25.is_empty() {
|
314 - | builder = builder.header("X-IntegerList", "");
|
315 - | } else {
|
316 - | for inner_26 in inner_25 {
|
317 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
|
318 - | let formatted_27 = encoder.encode();
|
324 + | for inner_26 in inner_25 {
|
325 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
|
326 + | let formatted_27 = encoder.encode();
|
327 + | if !formatted_27.is_empty() {
|
319 328 | let header_value = formatted_27;
|
320 329 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
321 330 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
322 331 | "header_integer_list",
|
323 332 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
324 333 | )
|
325 334 | })?;
|
326 335 | builder = builder.header("X-IntegerList", header_value);
|
327 336 | }
|
328 337 | }
|
329 338 | }
|
330 339 | if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
|
331 - | // Empty vec in header is serialized as an empty string
|
332 - | if inner_28.is_empty() {
|
333 - | builder = builder.header("X-BooleanList", "");
|
334 - | } else {
|
335 - | for inner_29 in inner_28 {
|
336 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
|
337 - | let formatted_30 = encoder.encode();
|
340 + | for inner_29 in inner_28 {
|
341 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
|
342 + | let formatted_30 = encoder.encode();
|
343 + | if !formatted_30.is_empty() {
|
338 344 | let header_value = formatted_30;
|
339 345 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
340 346 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
341 347 | "header_boolean_list",
|
342 348 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
343 349 | )
|
344 350 | })?;
|
345 351 | builder = builder.header("X-BooleanList", header_value);
|
346 352 | }
|
347 353 | }
|
348 354 | }
|
349 355 | if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
|
350 - | // Empty vec in header is serialized as an empty string
|
351 - | if inner_31.is_empty() {
|
352 - | builder = builder.header("X-TimestampList", "");
|
353 - | } else {
|
354 - | for inner_32 in inner_31 {
|
355 - | let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
356 + | for inner_32 in inner_31 {
|
357 + | let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
|
358 + | if !formatted_33.is_empty() {
|
356 359 | let header_value = formatted_33;
|
357 360 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
358 361 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
359 362 | "header_timestamp_list",
|
360 363 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
361 364 | )
|
362 365 | })?;
|
363 366 | builder = builder.header("X-TimestampList", header_value);
|
364 367 | }
|
365 368 | }
|
366 369 | }
|
367 370 | if let ::std::option::Option::Some(inner_34) = &input.header_enum {
|
368 371 | let formatted_35 = inner_34.as_str();
|
369 - | let header_value = formatted_35;
|
370 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
371 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
372 - | "header_enum",
|
373 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
374 - | )
|
375 - | })?;
|
376 - | builder = builder.header("X-Enum", header_value);
|
372 + | if !formatted_35.is_empty() {
|
373 + | let header_value = formatted_35;
|
374 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
375 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
376 + | "header_enum",
|
377 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
378 + | )
|
379 + | })?;
|
380 + | builder = builder.header("X-Enum", header_value);
|
381 + | }
|
377 382 | }
|
378 383 | if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
|
379 - | // Empty vec in header is serialized as an empty string
|
380 - | if inner_36.is_empty() {
|
381 - | builder = builder.header("X-EnumList", "");
|
382 - | } else {
|
383 - | for inner_37 in inner_36 {
|
384 - | let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
|
384 + | for inner_37 in inner_36 {
|
385 + | let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
|
386 + | if !formatted_38.is_empty() {
|
385 387 | let header_value = formatted_38;
|
386 388 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
387 389 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
388 390 | "header_enum_list",
|
389 391 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
390 392 | )
|
391 393 | })?;
|
392 394 | builder = builder.header("X-EnumList", header_value);
|
393 395 | }
|
394 396 | }
|
395 397 | }
|
396 398 | if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
|
397 399 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
|
398 400 | let formatted_40 = encoder.encode();
|
399 - | let header_value = formatted_40;
|
400 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
401 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
402 - | "header_integer_enum",
|
403 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
404 - | )
|
405 - | })?;
|
406 - | builder = builder.header("X-IntegerEnum", header_value);
|
401 + | if !formatted_40.is_empty() {
|
402 + | let header_value = formatted_40;
|
403 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
404 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
405 + | "header_integer_enum",
|
406 + | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
407 + | )
|
408 + | })?;
|
409 + | builder = builder.header("X-IntegerEnum", header_value);
|
410 + | }
|
407 411 | }
|
408 412 | if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
|
409 - | // Empty vec in header is serialized as an empty string
|
410 - | if inner_41.is_empty() {
|
411 - | builder = builder.header("X-IntegerEnumList", "");
|
412 - | } else {
|
413 - | for inner_42 in inner_41 {
|
414 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
|
415 - | let formatted_43 = encoder.encode();
|
413 + | for inner_42 in inner_41 {
|
414 + | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
|
415 + | let formatted_43 = encoder.encode();
|
416 + | if !formatted_43.is_empty() {
|
416 417 | let header_value = formatted_43;
|
417 418 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
418 419 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
419 420 | "header_integer_enum_list",
|
420 421 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
421 422 | )
|
422 423 | })?;
|
423 424 | builder = builder.header("X-IntegerEnumList", header_value);
|
424 425 | }
|
425 426 | }
|