-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
Summary: Continuation of Pull Request #7167 #7167 Needed to clean my repository. So created this Pull Request Closes #10575 Differential Revision: D4955291 Pulled By: shergin fbshipit-source-id: 94b9a086b7cf70ee6cc152d0b1a36c260140450e
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,7 +228,19 @@ - (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary<NSString *, id> *)q | |
NSURL *URL = [RCTConvert NSURL:query[@"url"]]; // this is marked as nullable in JS, but should not be null | ||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; | ||
request.HTTPMethod = [RCTConvert NSString:RCTNilIfNull(query[@"method"])].uppercaseString ?: @"GET"; | ||
request.allHTTPHeaderFields = [self stripNullsInRequestHeaders:[RCTConvert NSDictionary:query[@"headers"]]]; | ||
|
||
// Load and set the cookie header. | ||
NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:URL]; | ||
request.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
RedBlueThing
|
||
|
||
// Set supplied headers. | ||
NSDictionary *headers = [RCTConvert NSDictionary:query[@"headers"]]; | ||
[headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) { | ||
if (value) { | ||
[request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key]; | ||
} | ||
}]; | ||
|
||
request.timeoutInterval = [RCTConvert NSTimeInterval:query[@"timeout"]]; | ||
request.HTTPShouldHandleCookies = [RCTConvert BOOL:query[@"withCredentials"]]; | ||
NSDictionary<NSString *, id> *data = [RCTConvert NSDictionary:RCTNilIfNull(query[@"data"])]; | ||
|
I believe that this introduced an unintentional breaking change:
This explicitly sets the 'Cookie' header field and overrides the
HTTPShouldHandleCookies
option on line 245:The two seem to behave differently, on the Objective-C level a cookie set by
Set-Cookie
was not stored into the cookie storage and therefore my subsequent request failed.Uncommenting this line fixed the issue for me.