@@ -367,7 +367,12 @@ std::string HttpHandlerBase::GetRequestBodyForLoggingChecked(
367367 const std::string& request_body
368368) const {
369369 try {
370- return GetRequestBodyForLogging (request, context, request_body);
370+ const auto limit = GetConfig ().request_body_size_log_limit ;
371+ if (limit == 0 ) {
372+ return utils::log::ToLimitedUtf8 (request_body, 0 );
373+ }
374+ auto logging_request_body = GetRequestBodyForLogging (request, context, request_body);
375+ return utils::log::ToLimitedUtf8 (logging_request_body, limit);
371376 } catch (const std::exception& ex) {
372377 LOG_LIMITED_ERROR () << " failed to get request body for logging: " << ex;
373378 return " <error in GetRequestBodyForLogging>" ;
@@ -380,7 +385,12 @@ std::string HttpHandlerBase::GetResponseDataForLoggingChecked(
380385 const std::string& response_data
381386) const {
382387 try {
383- return GetResponseDataForLogging (request, context, response_data);
388+ const auto limit = GetConfig ().response_data_size_log_limit ;
389+ if (limit == 0 ) {
390+ return utils::log::ToLimitedUtf8 (response_data, 0 );
391+ }
392+ auto logging_response_data = GetResponseDataForLogging (request, context, response_data);
393+ return utils::log::ToLimitedUtf8 (logging_response_data, limit);
384394 } catch (const std::exception& ex) {
385395 LOG_LIMITED_ERROR () << " failed to get response data for logging: " << ex;
386396 return " <error in GetResponseDataForLogging>" ;
0 commit comments