|
@@ -143,6 +143,7 @@ static NSTimeInterval requestTimeout = 15.0f; // 超时时间
|
|
|
if (responseObj && cache) {
|
|
|
if (successBlock) successBlock(responseObj);
|
|
|
}
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
session = [manager GET:url parameters:params headers:headers progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
|
if (progressBlock) progressBlock(downloadProgress.completedUnitCount,
|
|
|
downloadProgress.totalUnitCount);
|
|
@@ -193,6 +194,7 @@ static NSTimeInterval requestTimeout = 15.0f; // 超时时间
|
|
|
if (responseObj && cache) {
|
|
|
if (successBlock) successBlock(responseObj);
|
|
|
}
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
session = [manager POST:url parameters:params headers:headers progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
if (progressBlock) progressBlock(uploadProgress.completedUnitCount,
|
|
|
uploadProgress.totalUnitCount);
|
|
@@ -245,6 +247,7 @@ static NSTimeInterval requestTimeout = 15.0f; // 超时时间
|
|
|
return session;
|
|
|
}
|
|
|
__weak typeof(manager) weakManager = manager;
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
session = [manager POST:url parameters:parameters headers:headers constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
|
NSString *fileName = nil;
|
|
|
|
|
@@ -367,7 +370,7 @@ static NSTimeInterval requestTimeout = 15.0f; // 超时时间
|
|
|
NSString *type;
|
|
|
NSArray *subStringArr;
|
|
|
__block KSURLSessionTask *session = nil;
|
|
|
-
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
NSURL *fileUrl = [[KSCacheManager shareManager] getDownloadDataFromCacheWithRequestUrl:url];
|
|
|
|
|
|
if (fileUrl) {
|
|
@@ -528,6 +531,15 @@ static NSTimeInterval requestTimeout = 15.0f; // 超时时间
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 移除请求头
|
|
|
+ *
|
|
|
+ */
|
|
|
+- (void)removeHeaderKey {
|
|
|
+ headers = @{};
|
|
|
+ [self.httpSessionManager.requestSerializer clearAuthorizationHeader];
|
|
|
+}
|
|
|
+
|
|
|
+ (NSArray *)currentRunningTasks {
|
|
|
return [[KSNetworking allTasks] copy];
|
|
|
}
|