Skip to content

return 404 when no matching route is found#1067

Merged
2 commits merged intooapi-codegen:masterfrom
sonu27:master
Jul 28, 2023
Merged

return 404 when no matching route is found#1067
2 commits merged intooapi-codegen:masterfrom
sonu27:master

Conversation

@sonu27
Copy link
Copy Markdown
Contributor

@sonu27 sonu27 commented May 29, 2023

Closes #1066

@jxsl13
Copy link
Copy Markdown

jxsl13 commented May 30, 2023

Should be 405. 404 is resource not found contrary to method not allowed/ not registered.

@sonu27
Copy link
Copy Markdown
Contributor Author

sonu27 commented May 30, 2023

Currently, it's returning 400 which is not correct.
If you hit most servers on the web where a route does not exist e.g. https://google.com/asdfadsfasdfasdf you will get 404.
405 is if the route exists but method is different.

@sonu27 sonu27 changed the title return 404 when a matching route is not found return 404 when no matching route is found May 30, 2023
@jxsl13
Copy link
Copy Markdown

jxsl13 commented May 30, 2023

fair point

@sonu27
Copy link
Copy Markdown
Contributor Author

sonu27 commented Jun 8, 2023

Just updated other middlewares too

@sonu27
Copy link
Copy Markdown
Contributor Author

sonu27 commented Jun 16, 2023

@deepmap-marcinr What do you think?

@ghost ghost merged commit bc2b028 into oapi-codegen:master Jul 28, 2023
debuggerpk pushed a commit to breuHQ/oapi-codegen that referenced this pull request Sep 18, 2023
* return 404 when a matching route is not found

* update other middleware and tests
danicc097 pushed a commit to danicc097/oapi-codegen that referenced this pull request Aug 31, 2024
* return 404 when a matching route is not found

* update other middleware and tests
This pull request was closed.
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

Successfully merging this pull request may close these issues.

[middleware] Request validator should return 404 not 400 if route is unable to be found

2 participants