Changing NSError ** parameter to NSError * __autoreleasing *
Minor reformatting of AFHTTPClient method signatures
This commit is contained in:
parent
fc16eef8b2
commit
70b7e0522c
2 changed files with 41 additions and 36 deletions
|
|
@ -519,7 +519,7 @@ extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
|
||||||
*/
|
*/
|
||||||
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
|
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
|
||||||
name:(NSString *)name
|
name:(NSString *)name
|
||||||
error:(NSError **)error;
|
error:(NSError * __autoreleasing *)error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
|
Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
|
||||||
|
|
@ -529,7 +529,10 @@ extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
|
||||||
@param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
|
@param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
|
||||||
@param filename The filename to be associated with the specified data. This parameter must not be `nil`.
|
@param filename The filename to be associated with the specified data. This parameter must not be `nil`.
|
||||||
*/
|
*/
|
||||||
- (void)appendPartWithFileData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType;
|
- (void)appendPartWithFileData:(NSData *)data
|
||||||
|
name:(NSString *)name
|
||||||
|
fileName:(NSString *)fileName
|
||||||
|
mimeType:(NSString *)mimeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
|
Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
|
||||||
|
|
@ -538,6 +541,7 @@ extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
|
||||||
@param name The name to be associated with the specified data. This parameter must not be `nil`.
|
@param name The name to be associated with the specified data. This parameter must not be `nil`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- (void)appendPartWithFormData:(NSData *)data name:(NSString *)name;
|
- (void)appendPartWithFormData:(NSData *)data
|
||||||
|
name:(NSString *)name;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -764,41 +764,9 @@ static inline NSString * AFContentTypeForPathExtension(NSString *extension) {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)appendPartWithFormData:(NSData *)data name:(NSString *)name {
|
|
||||||
NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
|
|
||||||
[mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"];
|
|
||||||
|
|
||||||
AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
|
|
||||||
bodyPart.stringEncoding = self.stringEncoding;
|
|
||||||
bodyPart.headers = mutableHeaders;
|
|
||||||
bodyPart.bodyContentLength = [data length];
|
|
||||||
bodyPart.inputStream = [NSInputStream inputStreamWithData:data];
|
|
||||||
|
|
||||||
[self.bodyStream appendHTTPBodyPart:bodyPart];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)appendPartWithFileData:(NSData *)data
|
|
||||||
name:(NSString *)name
|
|
||||||
fileName:(NSString *)fileName
|
|
||||||
mimeType:(NSString *)mimeType
|
|
||||||
{
|
|
||||||
NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
|
|
||||||
[mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
|
|
||||||
[mutableHeaders setValue:mimeType forKey:@"Content-Type"];
|
|
||||||
|
|
||||||
AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
|
|
||||||
bodyPart.stringEncoding = self.stringEncoding;
|
|
||||||
bodyPart.headers = mutableHeaders;
|
|
||||||
bodyPart.bodyContentLength = [data length];
|
|
||||||
bodyPart.inputStream = [NSInputStream inputStreamWithData:data];
|
|
||||||
|
|
||||||
[self.bodyStream appendHTTPBodyPart:bodyPart];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
|
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
|
||||||
name:(NSString *)name
|
name:(NSString *)name
|
||||||
error:(NSError **)error
|
error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
if (![fileURL isFileURL]) {
|
if (![fileURL isFileURL]) {
|
||||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Expected URL to be a file URL", nil) forKey:NSLocalizedFailureReasonErrorKey];
|
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Expected URL to be a file URL", nil) forKey:NSLocalizedFailureReasonErrorKey];
|
||||||
|
|
@ -833,6 +801,39 @@ static inline NSString * AFContentTypeForPathExtension(NSString *extension) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)appendPartWithFileData:(NSData *)data
|
||||||
|
name:(NSString *)name
|
||||||
|
fileName:(NSString *)fileName
|
||||||
|
mimeType:(NSString *)mimeType
|
||||||
|
{
|
||||||
|
NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
|
||||||
|
[mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
|
||||||
|
[mutableHeaders setValue:mimeType forKey:@"Content-Type"];
|
||||||
|
|
||||||
|
AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
|
||||||
|
bodyPart.stringEncoding = self.stringEncoding;
|
||||||
|
bodyPart.headers = mutableHeaders;
|
||||||
|
bodyPart.bodyContentLength = [data length];
|
||||||
|
bodyPart.inputStream = [NSInputStream inputStreamWithData:data];
|
||||||
|
|
||||||
|
[self.bodyStream appendHTTPBodyPart:bodyPart];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)appendPartWithFormData:(NSData *)data
|
||||||
|
name:(NSString *)name
|
||||||
|
{
|
||||||
|
NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
|
||||||
|
[mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"];
|
||||||
|
|
||||||
|
AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
|
||||||
|
bodyPart.stringEncoding = self.stringEncoding;
|
||||||
|
bodyPart.headers = mutableHeaders;
|
||||||
|
bodyPart.bodyContentLength = [data length];
|
||||||
|
bodyPart.inputStream = [NSInputStream inputStreamWithData:data];
|
||||||
|
|
||||||
|
[self.bodyStream appendHTTPBodyPart:bodyPart];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {
|
- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {
|
||||||
if ([self.bodyStream isEmpty]) {
|
if ([self.bodyStream isEmpty]) {
|
||||||
return self.request;
|
return self.request;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue