-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always write required query param keys, even if value is unset or emp…
…ty (#1973) * fix: issues when sending multipart-upload-related operations with no upload ID by making upload ID required add: Mandatory trait add: S3 customization to make Upload Ids mandatory * add: CHANGELOG.next.toml entry * update: strategy for tagging shapes as mandatory * remove: Mandatory trait undo: S3Decorator changes add: codegen to generate "else" branch after required query string serialization `if let Some` check add: missing tokio feature to `TokioTest` * update: mandatory-query-param.rs tests * format: run cargo fmt * update: return BuildError for missing required query params update: required-query-params.rs tests * formatting: make RustWriter.paramList more readable fix: code broken by merge from `main` * fix: handling of enum strings * add: codegen tests for required query params update: required enum query param codegen add: smithy-rs CHANGELOG.next.toml entry * fix: presigning.rs test * fix: use `toType` instead of `asType` fix: indentation in test
- Loading branch information
Zelda Hessler
authored
Nov 18, 2022
1 parent
c370c8d
commit 0a610ec
Showing
7 changed files
with
192 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
aws/sdk/integration-tests/s3/tests/required-query-params.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
use aws_sdk_s3::operation::AbortMultipartUpload; | ||
use aws_sdk_s3::Region; | ||
use aws_smithy_http::operation::error::BuildError; | ||
|
||
#[tokio::test] | ||
async fn test_error_when_required_query_param_is_unset() { | ||
let conf = aws_sdk_s3::Config::builder() | ||
.region(Region::new("us-east-1")) | ||
.build(); | ||
|
||
let err = AbortMultipartUpload::builder() | ||
.bucket("test-bucket") | ||
.key("test.txt") | ||
.build() | ||
.unwrap() | ||
.make_operation(&conf) | ||
.await | ||
.unwrap_err(); | ||
|
||
assert_eq!( | ||
BuildError::missing_field("upload_id", "cannot be empty or unset").to_string(), | ||
err.to_string(), | ||
) | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_error_when_required_query_param_is_set_but_empty() { | ||
let conf = aws_sdk_s3::Config::builder() | ||
.region(Region::new("us-east-1")) | ||
.build(); | ||
let err = AbortMultipartUpload::builder() | ||
.bucket("test-bucket") | ||
.key("test.txt") | ||
.upload_id("") | ||
.build() | ||
.unwrap() | ||
.make_operation(&conf) | ||
.await | ||
.unwrap_err(); | ||
|
||
assert_eq!( | ||
BuildError::missing_field("upload_id", "cannot be empty or unset").to_string(), | ||
err.to_string(), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.