Skip to content
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

Non-existing url does not return 404 #1025

Closed
kilinochi opened this issue Sep 21, 2019 · 3 comments
Closed

Non-existing url does not return 404 #1025

kilinochi opened this issue Sep 21, 2019 · 3 comments

Comments

@kilinochi
Copy link

2019-09-21_10-43-11
2019-09-21_10-41-51

And how I can return 404?

@kilinochi kilinochi changed the title Non-existent url does not return 404 Non-existing url does not return 404 Sep 21, 2019
@ragnarokatz
Copy link

ragnarokatz commented Oct 27, 2019

@kilinochi

in the code, it is indeed returning a response with a status of 404. however, the returned data object does not contain enough information to show that this is indeed the case.

router.use((req, res) => {
    if (!res.locals.data) {
      res.status(404)
      res.locals.data = {}
    }
...

@ragnarokatz
Copy link

I have opened a PR here for this issue: #1041
I have changed the returned object to:

router.use((req, res) => {
    if (!res.locals.data) {
      res.status(404)
      res.locals.data = {status_code: 404, error: 'Page not found'}
    }
...

@kilinochi
Copy link
Author

solve my problem, tnks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants