|
@@ -165,10 +165,10 @@
|
|
|
return $this;
|
|
|
}
|
|
|
public function handle(string $path, Request $req = null, Response $res = null, callable $fn = null, callable $onerror = null){
|
|
|
- if(strpos($path, $this->base) !== false){
|
|
|
- $path = ltrim($path, $this->base);
|
|
|
- if($path[0] != '/'){
|
|
|
- $path = '/'.$path;
|
|
|
+ if(strpos($path, $this->base) === 0){
|
|
|
+ $path = substr($path, strlen($this->base));
|
|
|
+ if(strpos($path, '/') !== 0){
|
|
|
+ $path = "/{$path}";
|
|
|
}
|
|
|
if(is_null($req)){
|
|
|
$req = new Request(Request::get_verb(), Request::get_url(), Request::get_headers(), Request::get_body());
|