@@ -33,7 +33,7 @@ import { SchemasRouter } from './Routers/SchemasRouter';
3333import { SessionsRouter } from './Routers/SessionsRouter' ;
3434import { UsersRouter } from './Routers/UsersRouter' ;
3535import { PurgeRouter } from './Routers/PurgeRouter' ;
36- import { AudiencesRouter } from './Routers/AudiencesRouter' ;
36+ import { AudiencesRouter } from './Routers/AudiencesRouter' ;
3737
3838import { ParseServerRESTController } from './ParseServerRESTController' ;
3939import * as controllers from './Controllers' ;
@@ -137,7 +137,11 @@ class ParseServer {
137137 maxUploadSize : maxUploadSize
138138 } ) ) ;
139139
140- api . use ( '/health' , ( req , res ) => res . sendStatus ( 200 ) ) ;
140+ api . use ( '/health' , ( function ( req , res ) {
141+ res . json ( {
142+ status : 'ok'
143+ } ) ;
144+ } ) ) ;
141145
142146 api . use ( '/' , bodyParser . urlencoded ( { extended : false } ) , new PublicAPIRouter ( ) . expressRouter ( ) ) ;
143147
@@ -252,7 +256,13 @@ class ParseServer {
252256 if ( Parse . serverURL ) {
253257 const request = require ( 'request' ) ;
254258 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' ) {
256266 /* eslint-disable no-console */
257267 console . warn ( `\nWARNING, Unable to connect to '${ Parse . serverURL } '.` +
258268 ` Cloud code and push notifications may be unavailable!\n` ) ;
0 commit comments