字符串判空方法:TextUtils.isEmpty();
虽然不影响上传,但Content-Type应该这样获取:
String fileName = value.getName();
String mimeType = "application/octet-stream";
String extension = MimeTypeMap.getFileExtensionFromUrl(fileName);
if (MimeTypeMap.getSingleton().hasExtension(extension)) {
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
}
OkHttp