convertRequest method

  1. @override
Request convertRequest(
  1. Request request
)
override

Converts the received Request to a Request which has a body with the HTTP representation of the original body.

Implementation

@override
Request convertRequest(Request request) {
  final Request req = applyHeader(
    request,
    contentTypeKey,
    formEncodedHeaders,
    override: false,
  );

  if (req.body is Map<String, String>) return req;

  if (req.body is Map) {
    return req.copyWith(body: <String, String>{
      for (final MapEntry e in req.body.entries)
        if (e.value != null) e.key.toString(): e.value.toString(),
    });
  }

  return req;
}