Skip to content

Commit aab6455

Browse files
authored
Updating default ping url to avoid 3xx redirections (#98)
1 parent d541d45 commit aab6455

8 files changed

+12
-12
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ withNetworkConnectivity(config: Config): (WrappedComponent) => EnhancedComponent
7373
type Config = {
7474
withRedux?: boolean = false,
7575
timeout?: number = 3000,
76-
pingServerUrl?: string = 'https://google.com',
76+
pingServerUrl?: string = 'http://www.google.com/',
7777
withExtraHeadRequest?: boolean = true,
7878
checkConnectionInterval?: number = 0,
7979
checkInBackground?: boolean = false,
@@ -85,7 +85,7 @@ type Config = {
8585

8686
`timeout`: amount of time (in ms) that the component should wait for the ping response. Defaults to 3s.
8787

88-
`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.
88+
`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.
8989

9090
`withExtraHeadRequest`: flag that denotes whether the extra ping check will be performed or not. Defaults to `true`.
9191

@@ -114,7 +114,7 @@ React component that accepts a function as children. It allows you to decouple y
114114
type Props = {
115115
children: (isConnected: boolean) => React$Element<any>
116116
timeout?: number = 3000,
117-
pingServerUrl?: string = 'https://google.com',
117+
pingServerUrl?: string = 'http://www.google.com/',
118118
withExtraHeadRequest?: boolean = true,
119119
}
120120
```

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-offline",
3-
"version": "3.9.0",
3+
"version": "3.9.1",
44
"description": "Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.",
55
"main": "./src/index.js",
66
"author": "Raul Gomez Acuña <[email protected]> (https://github.com/rauliyohmc)",

src/ConnectivityRenderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ConnectivityRenderer extends Component<DefaultProps, Props, State> {
3030

3131
static defaultProps: DefaultProps = {
3232
timeout: 3000,
33-
pingServerUrl: 'https://google.com',
33+
pingServerUrl: 'http://www.google.com/',
3434
withExtraHeadRequest: true,
3535
};
3636

src/checkInternetAccess.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import makeHttpRequest from './makeHttpRequest';
33

44
export default function checkInternetAccess(
55
timeout: number = 3000,
6-
url: string = 'https://google.com',
6+
url: string = 'http://www.google.com/',
77
): Promise<boolean> {
88
return new Promise((resolve: (value: boolean) => void) => {
99
makeHttpRequest({

src/checkInternetConnectionOnStartup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import checkInternetAccess from './checkInternetAccess';
77
// on Android, we need to use `isConnected.fetch`, that returns a promise which resolves with a boolean
88
export default function checkInternetConnectionOnStartup(
99
timeout: number = 3000,
10-
url: string = 'https://google.com',
10+
url: string = 'http://www.google.com/',
1111
): Promise<boolean> {
1212
let connectionChecked: Promise<boolean>;
1313
if (Platform.OS === 'ios') {

src/sagas.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function* handleConnectivityChange(
147147
export default function* networkEventsListenerSaga(
148148
{
149149
timeout = 3000,
150-
pingServerUrl = 'https://google.com',
150+
pingServerUrl = 'http://www.google.com/',
151151
withExtraHeadRequest = true,
152152
checkConnectionInterval = 0,
153153
}: Arguments = {},

src/withNetworkConnectivity.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const withNetworkConnectivity = (
2929
{
3030
withRedux = false,
3131
timeout = 3000,
32-
pingServerUrl = 'https://google.com',
32+
pingServerUrl = 'http://www.google.com/',
3333
withExtraHeadRequest = true,
3434
checkConnectionInterval = 0,
3535
checkInBackground = false,

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3972,9 +3972,9 @@ redux-mock-store@^1.2.2:
39723972
version "1.2.3"
39733973
resolved "https://registry.yarnpkg.com/redux-mock-store/-/redux-mock-store-1.2.3.tgz#1b3ad299da91cb41ba30d68e3b6f024475fb9e1b"
39743974

3975-
redux-saga@^0.15.6:
3976-
version "0.15.6"
3977-
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.15.6.tgz#8638dc522de6c6c0a496fe8b2b5466287ac2dc4d"
3975+
redux-saga@^0.16.0:
3976+
version "0.16.0"
3977+
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.0.tgz#0a231db0a1489301dd980f6f2f88d8ced418f724"
39783978

39793979
redux-thunk@^2.2.0:
39803980
version "2.2.0"

0 commit comments

Comments
 (0)