Skip to content

Commit 59966fb

Browse files
committed
added testing for httpclient override
1 parent 7287e41 commit 59966fb

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <aws/core/utils/Outcome.h>
2222
#include <aws/core/NoResult.h>
2323
#include <aws/core/http/HttpClientFactory.h>
24+
#include <aws/core/http/HttpClient.h>
2425
#include <aws/core/client/AWSErrorMarshaller.h>
2526
#include <aws/core/AmazonWebServiceResult.h>
2627
#include <utility>
@@ -99,12 +100,19 @@ namespace client
99100
m_serviceName(std::move(serviceName)),
100101
m_serviceUserAgentName(std::move(serviceUserAgentName)),
101102
m_httpClient(std::move(httpClient)),
102-
m_errorMarshaller(std::move(errorMarshaller)),
103-
m_interceptors{
104-
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
105-
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", *m_clientConfig)
106-
}
103+
m_errorMarshaller(std::move(errorMarshaller))
107104
{
105+
// Create modified config for chunking interceptor
106+
Aws::Client::ClientConfiguration chunkingConfig(*m_clientConfig);
107+
if (!m_httpClient->IsDefaultAwsHttpClient()) {
108+
chunkingConfig.httpClientChunkedMode = Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
109+
}
110+
111+
m_interceptors = {
112+
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
113+
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", chunkingConfig)
114+
};
115+
108116
baseInit();
109117
}
110118

src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,17 @@ void AwsSmithyClientBase::baseCopyAssign(const AwsSmithyClientBase& other,
103103
m_serviceUserAgentName = other.m_serviceUserAgentName;
104104
m_httpClient = std::move(httpClient);
105105
m_errorMarshaller = std::move(errorMarshaller);
106-
m_interceptors = Aws::Vector<std::shared_ptr<interceptor::Interceptor>>{Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig)};
107-
if (m_clientConfig->httpClientChunkedMode == Aws::Client::HttpClientChunkedMode::DEFAULT) {
108-
m_interceptors.emplace_back(Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", *m_clientConfig));
106+
107+
// Create modified config for chunking interceptor
108+
Aws::Client::ClientConfiguration chunkingConfig(*m_clientConfig);
109+
if (!m_httpClient->IsDefaultAwsHttpClient()) {
110+
chunkingConfig.httpClientChunkedMode = Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
109111
}
112+
113+
m_interceptors = Aws::Vector<std::shared_ptr<interceptor::Interceptor>>{
114+
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
115+
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", chunkingConfig)
116+
};
110117

111118
baseCopyInit();
112119
}

0 commit comments

Comments
 (0)