I have an API built with Slim 3, a route is defined as
$app->get('/usage/{protocol}', function(Request $request, Response $response, array $args) {
$protocol = !empty($args['protocol']) ? sanitize($args['protocol']) : null;
// do something...
});
My problem is that the protocol parameter can have a slash character in it multiple times / i.e.: 2022-123/A/B/C.
When I make a request for http://example.com/api/usage/2022-123/A/B/C I get the following error:
GET
http://example.com/api/usage/2022-123/A/B/Cresulted in a404 Not Foundresponse.
How do I fix this so that it treats the whole text as one parameter?
try this