From 72acaa46e3c5687e448ed4d46d5a07393b5bdbd3 Mon Sep 17 00:00:00 2001 From: siiiiilvio Date: Tue, 27 Sep 2022 18:11:59 -0500 Subject: [PATCH 1/3] Update index.d.ts Add responseHeaders to CompletedData type. --- index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 From 566832136a85dd9a14316a539b90dc950df2b612 Mon Sep 17 00:00:00 2001 From: siiiiilvio Date: Tue, 27 Sep 2022 18:17:59 -0500 Subject: [PATCH 2/3] Update VydiaRNFileUploader.m Add responseHeaders for iOS --- ios/VydiaRNFileUploader.m | 1 + 1 file changed, 1 insertion(+) 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)]; From 12376bd71d18cc408f55cc7a81b4da18d54343ed Mon Sep 17 00:00:00 2001 From: siiiiilvio Date: Tue, 27 Sep 2022 18:27:33 -0500 Subject: [PATCH 3/3] Update README.md Add iOS support for responseHeaders --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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