Skip to content

Commit 2146a13

Browse files
committed
Add Server Health Check
1 parent 1abb841 commit 2146a13

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Parse.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ Parse.LiveQuery = require('./ParseLiveQuery').default;
228228
Parse.LiveQueryClient = require('./LiveQueryClient').default;
229229
Parse.IndexedDB = require('./IndexedDBStorageController');
230230

231+
Parse.getServerHealth = function () {
232+
return CoreManager.getRESTController().request('GET', 'health');
233+
};
231234
Parse._request = function (...args) {
232235
return CoreManager.getRESTController().request.apply(null, args);
233236
};

src/__tests__/Parse-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ describe('Parse module', () => {
161161
CoreManager.set('REQUEST_BATCH_SIZE', 20);
162162
});
163163

164+
it('getServerHealth', () => {
165+
const controller = {
166+
request: jest.fn(),
167+
ajax: jest.fn(),
168+
};
169+
CoreManager.setRESTController(controller);
170+
Parse.getServerHealth();
171+
const [method, path] = controller.request.mock.calls[0];
172+
expect(method).toBe('GET');
173+
expect(path).toBe('health');
174+
});
175+
164176
it('_request', () => {
165177
const controller = {
166178
request: jest.fn(),

0 commit comments

Comments
 (0)