Skip to content

Commit f0d5a14

Browse files
committed
check range parameter in mock S3 client for transfer unit test
1 parent a0854dd commit f0d5a14

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/aws-cpp-sdk-transfer-unit-tests/TransferUnitTests.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ class MockS3Client : public S3Client {
2121
public:
2222
MockS3Client() : S3Client(){};
2323

24-
GetObjectOutcome GetObject(const GetObjectRequest&) const override {
24+
GetObjectOutcome GetObject(const GetObjectRequest& request) const override {
2525
GetObjectResult result;
26-
// Return wrong range to trigger validation failure
27-
result.SetContentRange("bytes 1024-2047/2048");
26+
27+
if (request.RangeHasBeenSet()) {
28+
// Always return mismatched range to trigger validation failure
29+
result.SetContentRange("bytes 1024-2047/2048");
30+
}
31+
2832
auto stream = Aws::New<std::stringstream>(ALLOCATION_TAG);
2933
*stream << "mock data";
3034
result.ReplaceBody(stream);

0 commit comments

Comments
 (0)