From 7cbdd7b6ac7db2192f7d0193d22326041517a63e Mon Sep 17 00:00:00 2001 From: Chris Lewis Date: Mon, 28 Jan 2019 05:17:41 -0800 Subject: [PATCH] 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 https://github.com/facebook/react-native/commit/0a71f48b1349ed09bcb6e76ba9ff8eb388518b15#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: https://github.com/facebook/react-native/pull/14068 I've also put up a new PR that adds an interface for replacing the client without introducing breaking changes: https://github.com/facebook/react-native/pull/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: https://github.com/facebook/react-native/pull/16972 Differential Revision: D13838805 Pulled By: cpojer fbshipit-source-id: 43606d1d141afb9b5dda4dd64e5ac5448771b45c --- .../react/modules/network/OkHttpClientProvider.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java index e3dde87ab..8373f95cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java @@ -46,12 +46,6 @@ public class OkHttpClientProvider { } return sClient; } - - // okhttp3 OkHttpClient is immutable - // This allows app to init an OkHttpClient with custom settings. - public static void replaceOkHttpClient(OkHttpClient client) { - sClient = client; - } public static OkHttpClient createClient() { if (sFactory != null) {