Skip to content
Browse files

Remove replaceOkHttpClient method (#16972)

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
  • Loading branch information...
cdlewis authored and facebook-github-bot committed Jan 28, 2019
1 parent 5a87093 commit 7cbdd7b6ac7db2192f7d0193d22326041517a63e
@@ -46,12 +46,6 @@ public static OkHttpClient getOkHttpClient() {
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) {

0 comments on commit 7cbdd7b

Please sign in to comment.
You can’t perform that action at this time.