Skip to content

Commit 18a98eb

Browse files
Introducing Transparent Proxy Builder (#851)
Co-authored-by: Matthias Kuhr <52661546+MatKuhr@users.noreply.github.com>
1 parent a1120bf commit 18a98eb

File tree

4 files changed

+968
-4
lines changed

4 files changed

+968
-4
lines changed

cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ public Collection<Header> getHeaders( @Nonnull final URI requestUri )
169169
final Collection<Header> allHeaders = new ArrayList<>();
170170

171171
allHeaders.addAll(customHeaders);
172-
allHeaders.addAll(getHeadersFromHeaderProviders(requestUri));
172+
allHeaders
173+
.addAll(
174+
getHeadersFromHeaderProviders(
175+
this,
176+
requestUri,
177+
customHeaderProviders,
178+
headerProvidersFromClassLoading));
173179
allHeaders.addAll(cachedHeadersFromProperties);
174180
if( allHeaders.stream().noneMatch(header -> header.getName().equalsIgnoreCase(HttpHeaders.AUTHORIZATION)) ) {
175181
allHeaders.addAll(getHeadersForAuthType());
@@ -180,7 +186,11 @@ public Collection<Header> getHeaders( @Nonnull final URI requestUri )
180186
return allHeaders;
181187
}
182188

183-
private List<Header> getHeadersFromHeaderProviders( @Nonnull final URI requestUri )
189+
static List<Header> getHeadersFromHeaderProviders(
190+
@Nonnull final HttpDestination destination,
191+
@Nonnull final URI requestUri,
192+
@Nonnull final List<DestinationHeaderProvider> customHeaderProviders,
193+
@Nonnull final List<DestinationHeaderProvider> headerProvidersFromClassLoading )
184194
{
185195
final List<DestinationHeaderProvider> aggregatedHeaderProviders = new ArrayList<>();
186196
aggregatedHeaderProviders.addAll(customHeaderProviders);
@@ -189,7 +199,7 @@ private List<Header> getHeadersFromHeaderProviders( @Nonnull final URI requestUr
189199
final String msg = "Found these {} destination header providers: {}";
190200
log.debug(msg, aggregatedHeaderProviders.size(), aggregatedHeaderProviders);
191201

192-
final DestinationRequestContext requestContext = new DestinationRequestContext(this, requestUri);
202+
final DestinationRequestContext requestContext = new DestinationRequestContext(destination, requestUri);
193203

194204
final List<Header> result = new ArrayList<>();
195205
for( final DestinationHeaderProvider headerProvider : aggregatedHeaderProviders ) {

0 commit comments

Comments
 (0)