buildRequestBodyStr method

String buildRequestBodyStr(
  1. RequestOptions options,
  2. Map<String, String> headers
)

Implementation

String buildRequestBodyStr(RequestOptions options,Map<String,String> headers) {
  String? contentType = contentType2(options.headers);
  if(isStr(contentType)){
    dynamic data =  options.data;
    // debugPrint("response : "+ data.toString());
    if (data == null){
      return "body null";
    }
    if(data is Map){
      return json.encode(data);
    }else if(data is List){
      return json.encode(data);
    }
    return data.toString();
  }
  headers["content-type-real"] = contentType.toString();
  headers["content-type"] = "text/plain";
  return "request body not text-> "+contentType.toString();
}