Skip to content

Commit 7cbdd7b

Browse files
cdlewisfacebook-github-bot
authored andcommitted
Remove replaceOkHttpClient method (#16972)
Summary: This method was originally intended to replace the OkHttp client used by React Native's networking library. However it has effectively been a noop since 0a71f48#diff-177100ae5a977e4060b54cc2b34c79a7, when the Networking library was modified to create a new client rather than use the reference provided by OkHttpClientProvider. Leaving this code in place is dangerous. There is no indication to users upgrading React Native that the method is no longer replacing the OkHttpClient used by the Networking library. Any functionality reliant on overriding the client will silently break. This caused us some problems internally. There's been a PR out for some time that seeks to reintroduce this functionality: #14068 I've also put up a new PR that adds an interface for replacing the client without introducing breaking changes: #17237 Do our unit tests continue to pass? Should be safe as this method is not used anywhere inside React Native. [ANDROID] [BREAKING] [Networking] - removed replaceOkHttpClient method in OkHttpClientProvider. Pull Request resolved: #16972 Differential Revision: D13838805 Pulled By: cpojer fbshipit-source-id: 43606d1d141afb9b5dda4dd64e5ac5448771b45c
1 parent 5a87093 commit 7cbdd7b

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ public static OkHttpClient getOkHttpClient() {
4646
}
4747
return sClient;
4848
}
49-
50-
// okhttp3 OkHttpClient is immutable
51-
// This allows app to init an OkHttpClient with custom settings.
52-
public static void replaceOkHttpClient(OkHttpClient client) {
53-
sClient = client;
54-
}
5549

5650
public static OkHttpClient createClient() {
5751
if (sFactory != null) {

0 commit comments

Comments
 (0)