File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -248,15 +248,20 @@ mon
248248 allHealthy = true ;
249249 for ( const service of services ) {
250250 try {
251- const { stdout } = await execPromise (
252- `curl -sf -o /dev/null -w "%{http_code}" ${ service . url } ` ,
253- { timeout : 5000 }
254- ) ;
255- const code = stdout . trim ( ) ;
256- if ( code === "200" ) {
251+ // Use native fetch instead of requiring curl to be installed
252+ const controller = new AbortController ( ) ;
253+ const timeoutId = setTimeout ( ( ) => controller . abort ( ) , 5000 ) ;
254+
255+ const response = await fetch ( service . url , {
256+ signal : controller . signal ,
257+ method : 'GET' ,
258+ } ) ;
259+ clearTimeout ( timeoutId ) ;
260+
261+ if ( response . status === 200 ) {
257262 console . log ( `✓ ${ service . name } : healthy` ) ;
258263 } else {
259- console . log ( `✗ ${ service . name } : unhealthy (HTTP ${ code } )` ) ;
264+ console . log ( `✗ ${ service . name } : unhealthy (HTTP ${ response . status } )` ) ;
260265 allHealthy = false ;
261266 }
262267 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments