Comments (9)
from carter.
Aha, I see.
I looked a little into it. I can see Carter uses IRouteBuilder.MapRoute(string template, RequestDelegate handler)
to map routes:
https://github.com/CarterCommunity/Carter/blob/master/src/CarterExtensions.cs#L47
But there is also an extension for IRouteBuilder.MapVerb(string verb, string template, RequestDelegate handler)
(Microsoft.AspNetCore.Routing 2.1.1.0)
Would that do the trick?
from carter.
from carter.
Can you explain what happened when you switched the route order around?
from carter.
Ran into this issue again today, it seems a bit weird cause I would expect it to filter on verb first and on matching route after (or something similar). But if this is how aspnet core routing works then I understand if that is hard to change. Do you know if there is an issue for aspnetcore for this issue?
from carter.
I don't know if there is an issue, if you find one please link back
from carter.
I experimented today with just doing this instead (in pure aspnetcore without any carter or mvc)
r.MapVerb("GET", "api/test/{id:long}/monkey", async (request, response, route) =>
{
await response.ReturnJsonWithStatusCode(HttpStatusCode.OK, new
{
Id = long.Parse(route.Values["id"].ToString()),
Test = "Test1"
});
});
r.MapVerb("PUT", "api/test/{id:long}/monkey", async (request, response, route) =>
{
await response.ReturnJsonWithStatusCode(HttpStatusCode.OK, new
{
Id = long.Parse(route.Values["id"].ToString()),
Test = "Test2"
});
});
In plain aspnetcore it seems like this is matching the correct route. When I call this I get the expected things back depending on verb. Doing a similar thing with carter gives 405 method not allowed.
Am I missing something obvious or wouldnt this mean that switching to using MapVerb would solve this for carter?
from carter.
You need to create a verb with a catch all route?
r.MapVerb("GET","{type}", async....
from carter.
@jchannon Actually, disregard my latest comment. I did some more tests today and I realized that the problem that I am having is not he same problem as the original one in this issue (should have realized this sooner, sorry). I will create a new issue with a reproduction of that one instead of littering this issue with unrelated things.
from carter.
Related Issues (20)
- Suggestion: Add functionality to create a "full" solution
- Possible startup performance issue HOT 6
- How to Authorize Endpoint for specific Role HOT 1
- `WithGroupName` and `WithDescription` results in that module not being surface in SwaggerUI HOT 6
- [Question] Is it possible to do property injection on a CarterModulse version 7 and autofac HOT 1
- Conditionaly Load UnLoad Module HOT 1
- How to configure my filters HOT 1
- [QUESTION] Any sample code using .WithOpenApi HOT 1
- Add support for registering an endpoint filter using an endpoint filter factory HOT 1
- [Question] The future of Carter HOT 1
- Endpoints Not Visible in EndpointsApiExplorer HOT 4
- suggest for nested work HOT 1
- Error On Register IN DI HOT 5
- Removed support to apply endpoint conventions globally HOT 2
- Can't find testhost.deps.json HOT 1
- Unable to change the field of the response data body to uppercase HOT 1
- Minimal AP Versioning HOT 2
- Open Api Summary is not drawing on Swagger UI HOT 3
- Trying to get swagger working with my project. HOT 3
- carter is missing NuGet package README file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carter.