logRequest method
Future<void>
logRequest(
- Request request
)
Implementation
Future<void> logRequest(Request request) async {
var isNotGet = request.method != 'GET';
var contentType = (isNotGet) ? request.headers['Content-Type'] : null;
var logTemplate = '\n[Request url] ${request.url.toString()}'
'\n[Request header] ${request.headers.toString()}'
'\n[Request param] ${request.url.queryParameters}'
'\n[Request body] ${_jsonUtil.encodeRawJson(request.body)}'
'\n[Request method] ${request.method}'
'\n[Request content-type] $contentType';
developer.log(logTemplate);
}