File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,20 @@ public function runAllChecksAction(Request $request)
85
85
));
86
86
}
87
87
88
+ /**
89
+ * @param Request $request
90
+ * @return \Symfony\Component\HttpFoundation\Response
91
+ */
92
+ public function runAllChecksHttpStatusAction (Request $ request )
93
+ {
94
+ $ report = $ this ->runTests ($ request );
95
+
96
+ return new Response (
97
+ '' ,
98
+ ($ report ->getGlobalStatus () === ArrayReporter::STATUS_OK ? 200 : 502 )
99
+ );
100
+ }
101
+
88
102
/**
89
103
* @param string $checkId
90
104
* @param Request $request
Original file line number Diff line number Diff line change 9
9
<route id =" liip_monitor_list_checks" pattern =" /checks" >
10
10
<default key =" _controller" >liip_monitor.health_controller:listAction</default >
11
11
</route >
12
+ <route id =" liip_monitor_run_all_checks_http_status" pattern =" /http_status_checks" >
13
+ <default key =" _controller" >liip_monitor.health_controller:runAllChecksHttpStatusAction</default >
14
+ </route >
12
15
<route id =" liip_monitor_run_all_checks" pattern =" /run" >
13
16
<default key =" _controller" >liip_monitor.health_controller:runAllChecksAction</default >
14
17
</route >
Original file line number Diff line number Diff line change 73
73
]</pre>
74
74
</dd>
75
75
76
+ <dt><a href="<?php echo $ request ->getUriForPath ($ request ->getPathInfo ().'http_status_checks ' ) ?> "><?php echo $ request ->getPathInfo ().'http_status_checks ' ?> </a></dt>
77
+ <dd>Performs all health checks and returns the results within the HTTP Status Code (200 if checks are OK, 502 otherwise).
78
+ <pre>
79
+ $ curl -XPOST -H "Accept: application/json" <?php echo $ request ->getUriForPath ($ request ->getPathInfo ().'http_status_checks ' ) ?>
80
+
81
+ HTTP/1.1 200 OK
82
+ </pre>
83
+
84
+ <pre>
85
+ $ curl -XPOST -H "Accept: application/json" <?php echo $ request ->getUriForPath ($ request ->getPathInfo ().'http_status_checks ' ) ?>
86
+
87
+ HTTP/1.1 502 Bad Gateway
88
+ </pre>
89
+ </dd>
90
+
76
91
<dt><a href="<?php echo $ request ->getUriForPath ($ request ->getPathInfo ().'run ' ) ?> "><?php echo $ request ->getPathInfo ().'run ' ?> </a></dt>
77
92
<dd>Performs all health checks and returns the results as an array of JSON objects.
78
93
<pre>
You can’t perform that action at this time.
0 commit comments