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