diff --git a/README.md b/README.md index 8475adb3..848cf7e9 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ Event Data |`id`|string|Required|The ID of the upload.| |`responseCode`|string|Required|HTTP status code received| |`responseBody`|string|Required|HTTP response body| -|`responseHeaders`|string|Required|HTTP response headers (Android)| +|`responseHeaders`|string|Required|HTTP response headers| ### cancelled diff --git a/index.d.ts b/index.d.ts index 8b2a07ce..6c564fa2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -14,10 +14,13 @@ declare module "react-native-background-upload" { } export interface CompletedData extends EventData { - responseCode: number responseBody: string + responseHeaders: { ++ [key: string]: string ++ } } + export type FileInfo = { name: string exists: boolean diff --git a/ios/VydiaRNFileUploader.m b/ios/VydiaRNFileUploader.m index a24bb36e..4a712a02 100644 --- a/ios/VydiaRNFileUploader.m +++ b/ios/VydiaRNFileUploader.m @@ -306,6 +306,7 @@ - (void)URLSession:(NSURLSession *)session if (response != nil) { [data setObject:[NSNumber numberWithInteger:response.statusCode] forKey:@"responseCode"]; + [data setObject:response.allHeaderFields forKey:@"responseHeaders"]; } //Add data that was collected earlier by the didReceiveData method NSMutableData *responseData = _responsesData[@(task.taskIdentifier)];