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 + | if !formatted_2.is_empty() {
|
170 171 | let header_value = formatted_2;
|
171 172 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
172 173 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
173 174 | "header_string",
|
174 175 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
175 176 | )
|
176 177 | })?;
|
177 178 | builder = builder.header("X-String", header_value);
|
178 179 | }
|
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();
|
184 + | if !formatted_4.is_empty() {
|
182 185 | let header_value = formatted_4;
|
183 186 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
184 187 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
185 188 | "header_byte",
|
186 189 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
187 190 | )
|
188 191 | })?;
|
189 192 | builder = builder.header("X-Byte", header_value);
|
190 193 | }
|
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();
|
198 + | if !formatted_6.is_empty() {
|
194 199 | let header_value = formatted_6;
|
195 200 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
196 201 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
197 202 | "header_short",
|
198 203 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
199 204 | )
|
200 205 | })?;
|
201 206 | builder = builder.header("X-Short", header_value);
|
202 207 | }
|
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();
|
212 + | if !formatted_8.is_empty() {
|
206 213 | let header_value = formatted_8;
|
207 214 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
208 215 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
209 216 | "header_integer",
|
210 217 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
211 218 | )
|
212 219 | })?;
|
213 220 | builder = builder.header("X-Integer", header_value);
|
214 221 | }
|
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();
|
226 + | if !formatted_10.is_empty() {
|
218 227 | let header_value = formatted_10;
|
219 228 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
220 229 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
221 230 | "header_long",
|
222 231 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
223 232 | )
|
224 233 | })?;
|
225 234 | builder = builder.header("X-Long", header_value);
|
226 235 | }
|
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();
|
240 + | if !formatted_12.is_empty() {
|
230 241 | let header_value = formatted_12;
|
231 242 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
232 243 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
233 244 | "header_float",
|
234 245 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
235 246 | )
|
236 247 | })?;
|
237 248 | builder = builder.header("X-Float", header_value);
|
238 249 | }
|
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();
|
254 + | if !formatted_14.is_empty() {
|
242 255 | let header_value = formatted_14;
|
243 256 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
244 257 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
245 258 | "header_double",
|
246 259 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
247 260 | )
|
248 261 | })?;
|
249 262 | builder = builder.header("X-Double", header_value);
|
250 263 | }
|
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();
|
268 + | if !formatted_16.is_empty() {
|
254 269 | let header_value = formatted_16;
|
255 270 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
256 271 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
257 272 | "header_true_bool",
|
258 273 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
259 274 | )
|
260 275 | })?;
|
261 276 | builder = builder.header("X-Boolean1", header_value);
|
262 277 | }
|
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();
|
282 + | if !formatted_18.is_empty() {
|
266 283 | let header_value = formatted_18;
|
267 284 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
268 285 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
269 286 | "header_false_bool",
|
270 287 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
271 288 | )
|
272 289 | })?;
|
273 290 | builder = builder.header("X-Boolean2", header_value);
|
274 291 | }
|
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 294 | for inner_20 in inner_19 {
|
281 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 309 | for inner_23 in inner_22 {
|
299 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 324 | for inner_26 in inner_25 {
|
317 325 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
|
318 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 340 | for inner_29 in inner_28 {
|
336 341 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
|
337 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 356 | for inner_32 in inner_31 {
|
355 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();
|
372 + | if !formatted_35.is_empty() {
|
369 373 | let header_value = formatted_35;
|
370 374 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
371 375 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
372 376 | "header_enum",
|
373 377 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
374 378 | )
|
375 379 | })?;
|
376 380 | builder = builder.header("X-Enum", header_value);
|
377 381 | }
|
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 384 | for inner_37 in inner_36 {
|
384 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();
|
401 + | if !formatted_40.is_empty() {
|
399 402 | let header_value = formatted_40;
|
400 403 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
401 404 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
402 405 | "header_integer_enum",
|
403 406 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
404 407 | )
|
405 408 | })?;
|
406 409 | builder = builder.header("X-IntegerEnum", header_value);
|
407 410 | }
|
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 413 | for inner_42 in inner_41 {
|
414 414 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
|
415 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 | }
|