From aab6455cd3257a41e0496335f53383d4b3d8bdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20G=C3=B3mez=20Acu=C3=B1a?= <4982414+rgommezz@users.noreply.github.com> Date: Mon, 11 Jun 2018 11:44:12 +0200 Subject: [PATCH] Updating default ping url to avoid 3xx redirections (#98) --- README.md | 6 +++--- package.json | 2 +- src/ConnectivityRenderer.js | 2 +- src/checkInternetAccess.js | 2 +- src/checkInternetConnectionOnStartup.js | 2 +- src/sagas.js | 2 +- src/withNetworkConnectivity.js | 2 +- yarn.lock | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f6b2eab9..3a520459 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ withNetworkConnectivity(config: Config): (WrappedComponent) => EnhancedComponent type Config = { withRedux?: boolean = false, timeout?: number = 3000, - pingServerUrl?: string = 'https://google.com', + pingServerUrl?: string = 'http://www.google.com/', withExtraHeadRequest?: boolean = true, checkConnectionInterval?: number = 0, checkInBackground?: boolean = false, @@ -85,7 +85,7 @@ type Config = { `timeout`: amount of time (in ms) that the component should wait for the ping response. Defaults to 3s. -`pingServerUrl`: remote server to ping to. It defaults to https://google.com since it's probably one the most stable servers out there, but you can provide your own if needed. +`pingServerUrl`: remote server to ping to. It defaults to http://www.google.com/ since it's probably one the most stable servers out there, but you can provide your own if needed. `withExtraHeadRequest`: flag that denotes whether the extra ping check will be performed or not. Defaults to `true`. @@ -114,7 +114,7 @@ React component that accepts a function as children. It allows you to decouple y type Props = { children: (isConnected: boolean) => React$Element timeout?: number = 3000, - pingServerUrl?: string = 'https://google.com', + pingServerUrl?: string = 'http://www.google.com/', withExtraHeadRequest?: boolean = true, } ``` diff --git a/package.json b/package.json index 3fa9fcc8..9735937c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-offline", - "version": "3.9.0", + "version": "3.9.1", "description": "Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.", "main": "./src/index.js", "author": "Raul Gomez Acuña (https://github.com/rauliyohmc)", diff --git a/src/ConnectivityRenderer.js b/src/ConnectivityRenderer.js index ee9b51cc..939cab97 100644 --- a/src/ConnectivityRenderer.js +++ b/src/ConnectivityRenderer.js @@ -30,7 +30,7 @@ class ConnectivityRenderer extends Component { static defaultProps: DefaultProps = { timeout: 3000, - pingServerUrl: 'https://google.com', + pingServerUrl: 'http://www.google.com/', withExtraHeadRequest: true, }; diff --git a/src/checkInternetAccess.js b/src/checkInternetAccess.js index 3247d8a8..fe6dcb04 100644 --- a/src/checkInternetAccess.js +++ b/src/checkInternetAccess.js @@ -3,7 +3,7 @@ import makeHttpRequest from './makeHttpRequest'; export default function checkInternetAccess( timeout: number = 3000, - url: string = 'https://google.com', + url: string = 'http://www.google.com/', ): Promise { return new Promise((resolve: (value: boolean) => void) => { makeHttpRequest({ diff --git a/src/checkInternetConnectionOnStartup.js b/src/checkInternetConnectionOnStartup.js index ecfdbca7..3b814041 100644 --- a/src/checkInternetConnectionOnStartup.js +++ b/src/checkInternetConnectionOnStartup.js @@ -7,7 +7,7 @@ import checkInternetAccess from './checkInternetAccess'; // on Android, we need to use `isConnected.fetch`, that returns a promise which resolves with a boolean export default function checkInternetConnectionOnStartup( timeout: number = 3000, - url: string = 'https://google.com', + url: string = 'http://www.google.com/', ): Promise { let connectionChecked: Promise; if (Platform.OS === 'ios') { diff --git a/src/sagas.js b/src/sagas.js index e5405254..aad98657 100644 --- a/src/sagas.js +++ b/src/sagas.js @@ -147,7 +147,7 @@ function* handleConnectivityChange( export default function* networkEventsListenerSaga( { timeout = 3000, - pingServerUrl = 'https://google.com', + pingServerUrl = 'http://www.google.com/', withExtraHeadRequest = true, checkConnectionInterval = 0, }: Arguments = {}, diff --git a/src/withNetworkConnectivity.js b/src/withNetworkConnectivity.js index 7684cc73..3ec425c5 100644 --- a/src/withNetworkConnectivity.js +++ b/src/withNetworkConnectivity.js @@ -29,7 +29,7 @@ const withNetworkConnectivity = ( { withRedux = false, timeout = 3000, - pingServerUrl = 'https://google.com', + pingServerUrl = 'http://www.google.com/', withExtraHeadRequest = true, checkConnectionInterval = 0, checkInBackground = false, diff --git a/yarn.lock b/yarn.lock index c3b17752..c0c8c43b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3972,9 +3972,9 @@ redux-mock-store@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/redux-mock-store/-/redux-mock-store-1.2.3.tgz#1b3ad299da91cb41ba30d68e3b6f024475fb9e1b" -redux-saga@^0.15.6: - version "0.15.6" - resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.15.6.tgz#8638dc522de6c6c0a496fe8b2b5466287ac2dc4d" +redux-saga@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.0.tgz#0a231db0a1489301dd980f6f2f88d8ced418f724" redux-thunk@^2.2.0: version "2.2.0"