encodeJson method

Request encodeJson(
  1. Request request
)
inherited

Implementation

Request encodeJson(Request request) {
  final String? contentType = request.headers[contentTypeKey];

  if ((contentType?.contains(jsonHeaders) ?? false) &&
      (request.body.runtimeType != String || !isJson(request.body))) {
    return request.copyWith(body: json.encode(request.body));
  }

  return request;
}