Skip to content

Commit

Permalink
Merge pull request #388 from box/IOS-14018
Browse files Browse the repository at this point in the history
Adding intermediate response handling to BOXAPIMultipartToJSONOperati…
  • Loading branch information
jdizoglio authored May 4, 2017
2 parents f4b06f8 + 5f8b889 commit 9746d4b
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ - (void)abortWithError:(NSError *)error;
*/
@implementation BOXAPIMultipartToJSONOperation

- (id)initWithURL:(NSURL *)URL HTTPMethod:(NSString *)HTTPMethod body:(NSDictionary *)body queryParams:(NSDictionary *)queryParams session:(BOXAbstractSession *)session
{
self = [super initWithURL:URL HTTPMethod:HTTPMethod body:body queryParams:queryParams session:session];
if (self != nil) {
// Initialize the responseData object to mutable data
self.responseData = [NSMutableData data];
}

return self;
}

#pragma mark - Append data to upload operation

- (void)appendMultipartPieceWithData:(NSData *)data fieldName:(NSString *)fieldName filename:(NSString *)filename MIMEType:(NSString *)MIMEType
Expand Down Expand Up @@ -127,15 +138,6 @@ - (void)sessionTask:(NSURLSessionTask *)sessionTask
}
}

- (void)sessionTask:(NSURLSessionTask *)sessionTask processIntermediateData:(NSData *)data
{
@synchronized (self) {
if (data != nil) {
[self processResponseData:data];
}
}
}

- (void)sessionTask:(NSURLSessionTask *)sessionTask didFinishWithResponse:(NSURLResponse *)response responseData:(nullable NSData *)responseData error:(NSError *)error
{
@synchronized (self) {
Expand Down

0 comments on commit 9746d4b

Please sign in to comment.