mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 07:14:59 -04:00
Update framework standards
This commit is contained in:
parent
232e056299
commit
09a91a998e
17 changed files with 282 additions and 98 deletions
|
@ -2,7 +2,7 @@
|
|||
use function Safe\session_unset;
|
||||
|
||||
try{
|
||||
HttpInput::ValidateRequestMethod([HttpMethod::Post]);
|
||||
HttpInput::ValidateRequestMethod([Enums\HttpMethod::Post]);
|
||||
|
||||
session_start();
|
||||
|
||||
|
@ -16,19 +16,19 @@ try{
|
|||
|
||||
session_unset();
|
||||
|
||||
if($requestType == HttpRequestType::Web){
|
||||
if($requestType == Enums\HttpRequestType::Web){
|
||||
$_SESSION['is-vote-created'] = $vote->UserId;
|
||||
http_response_code(303);
|
||||
header('Location: ' . $vote->Url);
|
||||
}
|
||||
else{
|
||||
// Access via HttpRequestType::Rest api; 201 CREATED with location
|
||||
// Access via Enums\HttpRequestType::Rest api; 201 CREATED with location
|
||||
http_response_code(201);
|
||||
header('Location: ' . $vote->Url);
|
||||
}
|
||||
}
|
||||
catch(Exceptions\InvalidPollVoteException $ex){
|
||||
if($requestType == HttpRequestType::Web){
|
||||
if($requestType == Enums\HttpRequestType::Web){
|
||||
$_SESSION['vote'] = $vote;
|
||||
$_SESSION['exception'] = $ex;
|
||||
|
||||
|
@ -37,7 +37,7 @@ catch(Exceptions\InvalidPollVoteException $ex){
|
|||
header('Location: /polls/' . (HttpInput::Str(GET, 'pollurlname') ?? '') . '/votes/new');
|
||||
}
|
||||
else{
|
||||
// Access via HttpRequestType::Rest api; 422 Unprocessable Entity
|
||||
// Access via Enums\HttpRequestType::Rest api; 422 Unprocessable Entity
|
||||
http_response_code(422);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue