1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-12-22 07:17:53 +01:00

Allow HEAD method for polls endpoints.

This commit is contained in:
Madeorsk 2019-02-24 14:36:44 +01:00
parent 9455338080
commit 0db54c0446

View File

@ -22,7 +22,7 @@ Flight::route("POST /polls", function () {
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid Content-Type.</h3>");
});
Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
Flight::route("HEAD|GET /polls/@id:[a-fA-F0-9]+", function ($id) {
global $VERLAINE;
$poll = Poll::load_poll($id);
if ($poll)
@ -95,7 +95,7 @@ Flight::route("POST /polls/@id:[a-fA-F0-9]+/vote", function ($id) {
Flight::notFound();
});
Flight::route("GET /polls/@id:[a-fA-F0-9]+/results", function ($id) {
Flight::route("HEAD|GET /polls/@id:[a-fA-F0-9]+/results", function ($id) {
global $VERLAINE;
$poll = Poll::load_poll($id);
if ($poll)
@ -138,13 +138,11 @@ Flight::route("GET|DELETE /polls/@id:[a-fA-F0-9]+/@token:[a-fA-F0-9]+", function
Flight::notFound();
});
Flight::route("GET /polls/@id:[a-fA-F0-9]+/results/svg", function ($id) {
Flight::route("HEAD|GET /polls/@id:[a-fA-F0-9]+/results/svg", function ($id) {
global $VERLAINE;
$poll = Poll::load_poll($id);
if ($poll)
{
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
}
else
Flight::notFound();
});