API 요청시 로그 추가

This commit is contained in:
현성필
2024-06-24 14:47:53 +09:00
parent 425535f6c5
commit 4e220ff9f7
2 changed files with 3 additions and 2 deletions
@@ -17,6 +17,7 @@ public class ApiClientFactory {
public ApiClient getClient(ApiRequestDTO request) {
switch (request.getType().toUpperCase()) {
case "HTTP":
case "HTTPFLAT":
return httpApiClient;
case "TCP":
return tcpApiClient;
@@ -72,6 +72,7 @@ public class NettyHttpApiClient implements ApiClient {
ch.pipeline().addLast(new HttpClientCodec());
ch.pipeline().addLast(new HttpObjectAggregator(65536));
ch.pipeline().addLast(new HttpContentDecompressor());
ch.pipeline().addLast(new HttpRequestLoggerHandler()); // Add custom HttpRequestLoggerHandler
ch.pipeline().addLast(new HttpHandler(responseFuture));
}
});
@@ -92,8 +93,7 @@ public class NettyHttpApiClient implements ApiClient {
if (queryIndex != -1) {
String path = fullPath.substring(0, queryIndex);
String queryParams = fullPath.substring(queryIndex + 1);
String encodedQueryParams = URLEncoder.encode(queryParams);
encodedPath = path + "?" + encodedQueryParams;
encodedPath = path + "?" + queryParams;
}
HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(apiRequest.getMethod()), encodedPath, content);