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

405 -> 404 #13

Closed
aheckmann opened this issue Aug 5, 2014 · 8 comments
Closed

405 -> 404 #13

aheckmann opened this issue Aug 5, 2014 · 8 comments

Comments

@aheckmann
Copy link
Member

A request made to a route that has not been defined is returning a 405 instead of 404.

it('missing route should 404', function(done) {
  app.get('/trailing-slash/', function*() {
    this.status = 204
  })

  request(server)
  .get('/trailing-slash')
  .expect(404, done)  // Error: expected 404 "Not Found", got 405 "Method Not Allowed"
});

If the case was that /trailing-slash was defined but not for a GET then a 405 would make sense.

@jonathanong
Copy link
Member

hmmm i think this might be routington trailing slash business

@jonathanong
Copy link
Member

i'm probably not going to work on this anytime soon since i don't particularly care for this. did you want me to add you as a maintainer for this and routington?

@aheckmann
Copy link
Member Author

sure thing —
Sent from Mailbox

On Tue, Aug 5, 2014 at 12:01 AM, Jonathan Ong notifications@github.com
wrote:

i'm probably not going to work on this anytime soon since i don't particularly care for this. did you want me to add you as a maintainer for this and routington?

Reply to this email directly or view it on GitHub:
#13 (comment)

@nervgh
Copy link
Collaborator

nervgh commented Feb 25, 2017

@jonathanong

It looks like the issue still exists.

I'm not sure where we need fix that error (trie-router or routington) but
Could we do something simple before parsing url? For example

url = url.replace(/\/$/, '')

@nervgh
Copy link
Collaborator

nervgh commented Mar 13, 2017

@jonathanong what do you think about it? ⬆️

@jonathanong
Copy link
Member

i think it needs to be an option. some people treat trailing slashes differently.

@jonathanong
Copy link
Member

yes, i think it's a routington thing

@nervgh
Copy link
Collaborator

nervgh commented Feb 17, 2018

I'm closing this issue because I've added the note about this behavior into docs. I think one of the possible solutions is to add koa-no-trailing-slash middleware to the top of the middleware queue.

@nervgh nervgh closed this as completed Feb 17, 2018
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

3 participants