-
Notifications
You must be signed in to change notification settings - Fork 249
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
root path gives me the same behavior with * #56
Comments
Can we try something quick. Can you please put the |
Same result. |
Ok, then that's a bug. Thanks for creating the issue. I'll take care soon. |
Thank you ! It's weird though, because no one opened the issue before, but it can't be that no one ran the same issue, when you usually define the home page on the "/" route. |
@ifig I just released var router = new Navigo('/v1');
var notFoundHandler = sinon.spy();
var modifyHandler = sinon.spy();
var defaultHandler = sinon.spy();
router
.notFound(notFoundHandler)
.on('modify', modifyHandler)
.on('modify/:name', modifyHandler)
.on('/', defaultHandler);
router.resolve('/v1/a/b/c');
router.resolve('/v1/modify');
router.resolve('/v1/modify/test');
expect(defaultHandler).to.not.be.called;
expect(notFoundHandler).to.be.called;
expect(modifyHandler).to.be.calledTwice; |
It works like a charm, thank you! |
I might have spoken too fast. I never enter the defaultHandler ('/'). |
@ifig sorry, can you please post your route definitions and the path that you are running against them. I can't reproduce the bug. |
I have a similar issue where I have to specify the root URL as an absolute URL, otherwise it won't replace it correctly. I'm trying to achieve an app where every 404 redirects to the root (
I've tried initializing the router with I've also tried to use a base path (For example |
Thanks for the report @richardsimko I'll dig into that soon. |
Nice, thanks! |
@richardsimko solved by using:
|
Cool, thanks! |
Is this not more of a workaround? I would expect the default root path to still work with .notFound and a main/home without using : Thanks |
@finppp can you please post your route definitions and give us an example of what's broken. I find difficult to write a test case that replicates your problem. |
This routes to home when I go to localhost:5000/asdf I apologise if I have overlooked something Also, it does work with Thanks |
@finppp I added a test case and it seems that I can't reproduce the bug. Is Navigo operating at the very top folder of your site. I mean is it like under Here's the test which had to reproduce the bug: describe('and the problem described in issue #56-2', function () {
it('should fire the notFound handler', function () {
var router = new Navigo(null, false, '#!');
var notFoundHandler = sinon.spy();
var homeHandler = sinon.spy();
var postsHandler = sinon.spy();
router
.notFound(notFoundHandler)
.on({
'/': homeHandler,
'/my-posts': postsHandler
});
router.resolve();
router.resolve('asdf');
expect(homeHandler).to.be.calledOnce;
expect(notFoundHandler).to.be.calledOnce;
});
}); |
I am having trouble with the following code : When I type the following url '/v1/a/b/c', I'd like to match the "not found" handler. Instead, I match the root path that I defined at last ('/'). It's like I would have defined it that way : '/*'.
The text was updated successfully, but these errors were encountered: