Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add responseHeaders to the data object when upload is completed #313

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ios/VydiaRNFileUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down