Skip to content

Commit aa1f126

Browse files
committed
Rename to OpenApiResponseListener
1 parent b94ace5 commit aa1f126

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/ApiClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class ApiClient
9494
private final String tempFolderPath;
9595

9696
@With
97-
private final OpenApiResponseListener responseMetadataListener;
97+
private final OpenApiResponseListener openApiResponseListener;
9898

9999
// Methods that can have a request body
100100
private static final Set<Method> BODY_METHODS = Set.of(Method.POST, Method.PUT, Method.PATCH, Method.DELETE);
@@ -570,7 +570,7 @@ public <T> T invokeAPI(
570570

571571
try {
572572
final HttpClientResponseHandler<T> responseHandler =
573-
new DefaultApiResponseHandler<>(objectMapper, tempFolderPath, returnType, responseMetadataListener);
573+
new DefaultApiResponseHandler<>(objectMapper, tempFolderPath, returnType, openApiResponseListener);
574574
return httpClient.execute(builder.build(), context, responseHandler);
575575
}
576576
catch( IOException e ) {

datamodel/openapi/openapi-core/src/main/java/com/sap/cloud/sdk/services/openapi/apache/DefaultApiResponseHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class DefaultApiResponseHandler<T> implements HttpClientResponseHandler<T>
6969

7070
/** Optional listener for OpenAPI response including status code and headers */
7171
@Nullable
72-
private final OpenApiResponseListener responseMetadataListener;
72+
private final OpenApiResponseListener openApiResponseListener;
7373

7474
@Nullable
7575
@Override
@@ -107,8 +107,8 @@ private T processResponse( @Nonnull final ClassicHttpResponse response )
107107
{
108108
final int statusCode = response.getCode();
109109
final Map<String, List<String>> headers = transformResponseHeaders(response.getHeaders());
110-
if( responseMetadataListener != null ) {
111-
responseMetadataListener.onResponse(new OpenApiResponse(statusCode, headers));
110+
if( openApiResponseListener != null ) {
111+
openApiResponseListener.onResponse(new OpenApiResponse(statusCode, headers));
112112
}
113113

114114
if( statusCode == HttpStatus.SC_NO_CONTENT ) {

datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/apiclient/ApacheApiClientResponseHandlingTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void testResponseMetadataListener( final WireMockRuntimeInfo wmInfo )
4747

4848
final AtomicReference<OpenApiResponse> metadata = new AtomicReference<>();
4949
final ApiClient apiClient =
50-
ApiClient.create().withBasePath(wmInfo.getHttpBaseUrl()).withResponseMetadataListener(metadata::set);
50+
ApiClient.create().withBasePath(wmInfo.getHttpBaseUrl()).withOpenApiResponseListener(metadata::set);
5151

5252
final TestApi api = new TestApi(apiClient);
5353
final TestResponse result = api.executeRequest();
@@ -75,10 +75,7 @@ void testCaseInsensitiveHeaderLookup( final WireMockRuntimeInfo wmInfo )
7575

7676
final AtomicReference<OpenApiResponse> capturedResponse = new AtomicReference<>();
7777
final ApiClient apiClient =
78-
ApiClient
79-
.create()
80-
.withBasePath(wmInfo.getHttpBaseUrl())
81-
.withResponseMetadataListener(capturedResponse::set);
78+
ApiClient.create().withBasePath(wmInfo.getHttpBaseUrl()).withOpenApiResponseListener(capturedResponse::set);
8279

8380
final TestApi api = new TestApi(apiClient);
8481
api.executeRequest();

0 commit comments

Comments
 (0)