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 0a71f48b13 (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
This commit is contained in:
Chris Lewis 2019-01-28 05:17:41 -08:00 committed by Facebook Github Bot
parent 5a87093e1a
commit 7cbdd7b6ac
1 changed files with 0 additions and 6 deletions

View File

@ -47,12 +47,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) {
return sFactory.createNewNetworkModuleClient();