Micro routing with URL

I am building an API using micro application, and I am trying to pass an URL through get, it seems router couldn't accpet http url straight away.

http://i.xy.com/agent/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png

$app->map('/agent/{url:(.*)}', [
        $image,
        "agentAction"
    ])->via(['GET']);

In action, the URL I got is https:/www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png, which is missing a slash after https, does anyone experience a case like this before?



2.2k

i couldn't figure the proper solution but i got one and its ugly but it works

$app->get(
    "/agent/{url:(.*)}",
    function ($url) {
        exit(var_dump(substr($_SERVER['REQUEST_URI'], strlen($this->config->application->baseUri . 'agent/'))));
    }
);