Skip to content

Commit 254fdc6

Browse files
committed
- Add new parameter disableCompression to log http payloads
1 parent 082cc9d commit 254fdc6

5 files changed

Lines changed: 39 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
- oas 3.0 base path handling (See issue [#297](https://github.com/Axway-API-Management-Plus/apim-cli/issues/297)
1212
- BackendBasepath problem exporting SOAP API with apim-cli (See issue [#299](https://github.com/Axway-API-Management-Plus/apim-cli/issues/299)
13+
- Importing SOAP API with apim-cli adds "+" instead of spaces for the Backend API name (See issue [#301](https://github.com/Axway-API-Management-Plus/apim-cli/issues/301)
1314

1415
### Changed
16+
- Added new parameter disableCompression. The parameter enables logging API Gateway responses for debugging.
17+
- Usage - **api get -u apiadmin -p Space*Salt*25 -h 208.67.129.25 -port 8075 -n "PetStore 3.0" -o json -disableCompression**
18+
- Enable http client header and payload logging using jvm -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG
1519
- If backendBasepath is present in api-config.json, Openapi (OAS 3) servers.url will be modified based on the values. E.g
1620
- If open api servers.url is /api/v3 and backendBasepath is https://backend, the openapi server.url will be replaced with https://backend/api/v3
1721
- If open api servers.url is https://petstore.swagger.io/api/v3 and backendBasepath is https://backend, the openapi server.url will be replaced with https://backend/api/v3
1822
- If open api servers.url is https://petstore.swagger.io/api/v3 and backendBasepath is https://backend/api, the openapi server.url will be replaced with https://backend/api/api/v3
1923

20-
2124
## [1.12.2] 2022-07-28
2225

2326
### Fixed

modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreCLIOptions.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ public Parameters getParams() throws AppException {
4545
params.setProxyUsername(getValue("httpProxyUsername"));
4646
params.setProxyPassword(getValue("httpProxyPassword"));
4747
params.setRetryDelay(getValue("retryDelay"));
48-
49-
50-
return (Parameters) params;
48+
params.setDisableCompression(hasOption("disableCompression"));
49+
return params;
5150
}
5251

5352
@Override
@@ -159,6 +158,10 @@ public void addOptions() {
159158
option.setRequired(false);
160159
option.setArgName("true");
161160
cliOptions.addInternalOption(option);
161+
162+
option = new Option("disableCompression", false, "Disable Http Client gzip Compression");
163+
option.setRequired(false);
164+
cliOptions.addInternalOption(option);
162165
}
163166

164167
@Override

modules/apim-adapter/src/main/java/com/axway/apim/lib/CoreParameters.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public static Mode valueOfDefault(String key) {
108108
private String proxyPassword;
109109

110110
private int retryDelay;
111+
112+
private boolean disableCompression;
111113

112114
public CoreParameters() {
113115
super();
@@ -544,6 +546,14 @@ public List<CacheType> getEnabledCacheTypes() {
544546
return null;
545547
}
546548

549+
public boolean isDisableCompression() {
550+
return disableCompression;
551+
}
552+
553+
public void setDisableCompression(boolean disableCompression) {
554+
this.disableCompression = disableCompression;
555+
}
556+
547557
@Override
548558
public String toString() {
549559
return "[hostname=" + hostname + ", username=" + username + ", stage=" + stage + "]";

modules/apim-adapter/src/main/java/com/axway/apim/lib/utils/rest/APIMHttpClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ private void createConnection(URI uri) throws AppException {
120120
}
121121
defaultRequestConfig.setProxy(proxyHost);
122122
}
123+
if(params.isDisableCompression())
124+
clientBuilder.disableContentCompression();
123125
clientBuilder.setDefaultRequestConfig(defaultRequestConfig.build());
124126
this.httpClient = clientBuilder.build();
125127
} catch (Exception e) {

modules/apim-adapter/src/test/java/com/axway/lib/CoreCLIOptionsTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,21 @@ public void testAPIBasePathParam() throws ParseException, AppException {
115115

116116
Assert.assertEquals(params.getApiBasepath(), "/fr/apim/v13/portal");
117117
}
118+
119+
@Test
120+
public void testDisableCompression() throws AppException {
121+
String[] args = {"-disableCompression"};
122+
CLIOptions options = SampleCLIOptions.create(args);
123+
CoreParameters params = (CoreParameters) options.getParams();
124+
Assert.assertEquals(params.isDisableCompression(), true);
125+
126+
}
127+
@Test
128+
public void testDisableCompressionNegative() throws AppException {
129+
String[] args = {""};
130+
CLIOptions options = SampleCLIOptions.create(args);
131+
CoreParameters params = (CoreParameters) options.getParams();
132+
Assert.assertEquals(params.isDisableCompression(), false);
133+
134+
}
118135
}

0 commit comments

Comments
 (0)