Skip to content

Commit 31842b9

Browse files
tadeuzagallooss sync
authored andcommitted
[ReactNative] Return the appropriate status code from XHR
Summary: Manually import pull request facebook#169 from github https://github.com/facebook/react-native/pull/169/files Test Plan: Just do a XMLHttpRequest
1 parent fbe2b78 commit 31842b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Libraries/Network/RCTDataManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ - (void)executeQuery:(NSString *)queryType
5050
} else {
5151
encoding = NSUTF8StringEncoding;
5252
}
53+
int responseCode = (int)[((NSHTTPURLResponse *)response) statusCode];
5354
NSString *returnData = [[NSString alloc] initWithData:data encoding:encoding];
54-
responseJSON = @{@"status": @200, @"responseText": returnData};
55+
responseJSON = @{@"status": @(responseCode), @"responseText": returnData};
5556
} else {
5657
responseJSON = @{@"status": @0, @"responseText": [connectionError localizedDescription]};
5758
}

0 commit comments

Comments
 (0)