Skip to content

Commit

Permalink
Updating default ping url to avoid 3xx redirections (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgommezz committed Jun 11, 2018
1 parent d541d45 commit aab6455
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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,
Expand All @@ -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`.

Expand Down Expand Up @@ -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<any>
timeout?: number = 3000,
pingServerUrl?: string = 'https://google.com',
pingServerUrl?: string = 'http://www.google.com/',
withExtraHeadRequest?: boolean = true,
}
```
Expand Down
2 changes: 1 addition & 1 deletion 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 <raulgdeveloper@gmail.com> (https://github.com/rauliyohmc)",
Expand Down
2 changes: 1 addition & 1 deletion src/ConnectivityRenderer.js
Expand Up @@ -30,7 +30,7 @@ class ConnectivityRenderer extends Component<DefaultProps, Props, State> {

static defaultProps: DefaultProps = {
timeout: 3000,
pingServerUrl: 'https://google.com',
pingServerUrl: 'http://www.google.com/',
withExtraHeadRequest: true,
};

Expand Down
2 changes: 1 addition & 1 deletion src/checkInternetAccess.js
Expand Up @@ -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<boolean> {
return new Promise((resolve: (value: boolean) => void) => {
makeHttpRequest({
Expand Down
2 changes: 1 addition & 1 deletion src/checkInternetConnectionOnStartup.js
Expand Up @@ -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<boolean> {
let connectionChecked: Promise<boolean>;
if (Platform.OS === 'ios') {
Expand Down
2 changes: 1 addition & 1 deletion src/sagas.js
Expand Up @@ -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 = {},
Expand Down
2 changes: 1 addition & 1 deletion src/withNetworkConnectivity.js
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -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"
Expand Down

0 comments on commit aab6455

Please sign in to comment.