-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ping resource and test * Adding charset to /ping * Set cache-control explicitly
- Loading branch information
Showing
5 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: Journal CMS (Ping) | ||
type: module | ||
description: Check to see the site is up | ||
core: 8.x | ||
package: Journal CMS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
jcms_ping.check.json: | ||
path: '/ping' | ||
defaults: | ||
_controller: \Drupal\jcms_ping\Controller\PingController::siteStatus | ||
options: | ||
no_cache: TRUE | ||
requirements: | ||
_access: 'TRUE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Drupal\jcms_ping\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* Controller to handle a ping request for journal-cms. | ||
*/ | ||
class PingController { | ||
|
||
/** | ||
* String sent in responses, to verify site status. | ||
* | ||
* @var string | ||
*/ | ||
const SITE_STATUS_RESPONSE = 'pong'; | ||
|
||
/** | ||
* Checks the site status. | ||
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* The response. | ||
*/ | ||
public function siteStatus() { | ||
$response = new Response(self::SITE_STATUS_RESPONSE); | ||
$response->headers->set('Content-Type', 'text/plain; charset=UTF-8'); | ||
$response->headers->set('Cache-Control', 'must-revalidate, no-cache, no-store, private'); | ||
return $response; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters