add / at last, via SCF default link.

pull/525/head
qkqpttgf 2022-01-09 14:05:25 +08:00 committed by GitHub
parent ac4defe663
commit c8adcbbd7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -88,6 +88,9 @@ function main_handler($event, $context)
$event = json_decode(json_encode($event), true); $event = json_decode(json_encode($event), true);
$context = json_decode(json_encode($context), true); $context = json_decode(json_encode($context), true);
printInput($event, $context); printInput($event, $context);
if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
}
unset($_POST); unset($_POST);
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);