-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Pecee\SimpleRouter\Exceptions\NotFoundHttpException using Postman/Ajax #626
Comments
Hello, can you please provide your index.php content and the namespace "header" of your Login class? Some more information would be great so I can reproduce your issue and find a solution. ~ Marius |
Hi, thank you for your patience! My index.php is quite simple. <?php
use Eden\System\RouterService;
include_once __DIR__ . '/../vendor/autoload.php';
ini_set('display_errors', 1);
$router = new RouterService;
$router->init(); In <?php
namespace Eden\System;
use Eden\System\Middlewares\Authentication;
use Pecee\SimpleRouter\SimpleRouter as Router; // And yes! I'm importing SimpleRouter as Router, [as] stated.
class RouterService extends Router {
public function init() {
Router::setDefaultNamespace('\Eden\App\Controllers'); // Which are the folder that contains another subfolders with the stated controllers.
Router::group(['middleware' => Authentication::class], function (){
Router::post('/api/login/request', 'Auth\Login@request');
}
Router::start();
}
} The mentioned middleware function is simple, only to aknowledge if the user is online or not, returning the user value if it is or the null value if not, and returning to the other middlewares that aren't featured on this issue. By the way, it's important to mention that this code is labelled as private since it's a revisit of an old open-source project (about three years of existance), so I can't provide code that's sensitive to the project's security and its related core functions. Again, thank you for your patience and comprehension. Best regards, EditSorry, I forgot to include the Login class namespace. <?php
namespace Eden\App\Controllers\Login; Edit 2I managed to fix it. It was just the namespace as you said. Thank you so much for your patience. You deserve the best, man! Grateful, |
Hello, I have to confirm my idea, but I think the route namespace is not used as a prefix if there is another namespace provided. Case 1: A solution for you could be to provide the class and method using an array When you are interested in a prefix namespace approach, please create a feature request in my fork. I hope this helped you and if not I will try to find the issue. I am currently not at home so let me know if there is anything else. ~ Marius |
Hi, I'm using Simple-Router for quite a while and it's been marvelous, but I'm facing a problem with post requests, specially on my /api/login/request URL. For some reason it returns this error, which it's presented down below:
My project seems fine, all parameters are colected via URL (?email=&password)/URL-Encoding (www-x-form-urlencoded), but it simply doesn't do its job, in case, log in.
I wondered if I needed to specify any
csrf_token
parameter, but apparently that's not the issue.I appreciate help on this matter, since I intent on using this library on another platforms, including administrative ones.
Edit
This is my route code.
The controller mentioned has its function labelled as public, in other words...
The text was updated successfully, but these errors were encountered: