@@ -33,7 +33,7 @@ import { SchemasRouter } from './Routers/SchemasRouter';
33
33
import { SessionsRouter } from './Routers/SessionsRouter' ;
34
34
import { UsersRouter } from './Routers/UsersRouter' ;
35
35
import { PurgeRouter } from './Routers/PurgeRouter' ;
36
- import { AudiencesRouter } from './Routers/AudiencesRouter' ;
36
+ import { AudiencesRouter } from './Routers/AudiencesRouter' ;
37
37
38
38
import { ParseServerRESTController } from './ParseServerRESTController' ;
39
39
import * as controllers from './Controllers' ;
@@ -137,7 +137,11 @@ class ParseServer {
137
137
maxUploadSize : maxUploadSize
138
138
} ) ) ;
139
139
140
- api . use ( '/health' , ( req , res ) => res . sendStatus ( 200 ) ) ;
140
+ api . use ( '/health' , ( function ( req , res ) {
141
+ res . json ( {
142
+ status : 'ok'
143
+ } ) ;
144
+ } ) ) ;
141
145
142
146
api . use ( '/' , bodyParser . urlencoded ( { extended : false } ) , new PublicAPIRouter ( ) . expressRouter ( ) ) ;
143
147
@@ -252,7 +256,13 @@ class ParseServer {
252
256
if ( Parse . serverURL ) {
253
257
const request = require ( 'request' ) ;
254
258
request ( Parse . serverURL . replace ( / \/ $ / , "" ) + "/health" , function ( error , response , body ) {
255
- if ( error || response . statusCode !== 200 || body !== "OK" ) {
259
+ let json ;
260
+ try {
261
+ json = JSON . parse ( body ) ;
262
+ } catch ( e ) {
263
+ json = null ;
264
+ }
265
+ if ( error || response . statusCode !== 200 || ! json || json && json . status !== 'ok' ) {
256
266
/* eslint-disable no-console */
257
267
console . warn ( `\nWARNING, Unable to connect to '${ Parse . serverURL } '.` +
258
268
` Cloud code and push notifications may be unavailable!\n` ) ;
0 commit comments