mirror of
https://git.cant.at/Madeorsk/PollVerlaine
synced 2024-11-22 07:04:32 +01:00
Allow HEAD method for polls endpoints.
This commit is contained in:
parent
9455338080
commit
0db54c0446
@ -22,7 +22,7 @@ Flight::route("POST /polls", function () {
|
|||||||
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid Content-Type.</h3>");
|
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;
|
global $VERLAINE;
|
||||||
$poll = Poll::load_poll($id);
|
$poll = Poll::load_poll($id);
|
||||||
if ($poll)
|
if ($poll)
|
||||||
@ -95,7 +95,7 @@ Flight::route("POST /polls/@id:[a-fA-F0-9]+/vote", function ($id) {
|
|||||||
Flight::notFound();
|
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;
|
global $VERLAINE;
|
||||||
$poll = Poll::load_poll($id);
|
$poll = Poll::load_poll($id);
|
||||||
if ($poll)
|
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::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;
|
global $VERLAINE;
|
||||||
$poll = Poll::load_poll($id);
|
$poll = Poll::load_poll($id);
|
||||||
if ($poll)
|
if ($poll)
|
||||||
{
|
|
||||||
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
|
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Flight::notFound();
|
Flight::notFound();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user