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

Return 404 when file not found #21

Closed
yoshuawuyts opened this issue Apr 14, 2014 · 4 comments
Closed

Return 404 when file not found #21

yoshuawuyts opened this issue Apr 14, 2014 · 4 comments

Comments

@yoshuawuyts
Copy link

When a file is not found status is set to 500 and not 404. A workaround is easy, but it'd be more elegant if it was supported out of the box.

Not sure if this needs adjusting in send/index.js:79 or if it should be overwritten here.

@tj
Copy link
Member

tj commented Apr 14, 2014

what's the err.code you're getting? it should just return and fallback to the default koa 404

@yoshuawuyts
Copy link
Author

  <-- GET /build.css
  xxx GET /build.css 500 3ms -
Error: yield a function, promise, generator, array, or object
    at next (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:109:12)
    at Object.<anonymous> (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:50:5)
    at next (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:93:21)
    at Object.<anonymous> (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:50:5)
    at Object.next (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:93:21)
    at Object.<anonymous> (/home/yoshua/Code/server/node_modules/koa/node_modules/co/index.js:96:18)
    at processImmediate [as _immediateCallback] (timers.js:374:17)

Requests to files that exist get handled without a problem though.

@tj
Copy link
Member

tj commented Apr 14, 2014

well there's an error right there :p that's what it's a 500

if you can repro with a little stand-alone script with just koa-static I can check it out

@yoshuawuyts
Copy link
Author

Turns out I was yielding the whole module. Woops :p

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