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

Route Fails to Parse More Than One Parameter #161

Closed
scottoffen opened this issue Jan 11, 2017 · 0 comments
Closed

Route Fails to Parse More Than One Parameter #161

scottoffen opened this issue Jan 11, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@scottoffen
Copy link
Owner

When parsing a route for parameters, only the first match is making it into the PathParameters property of HttpContext.Request.

var route = new Route(context =>
{
    Console.WriteLine($"Param1: {context.Request.PathParameters["param1"]}");
    Console.WriteLine($"Param2: {context.Request.PathParameters["param2"]}");
    context.Response.SendResponse(HttpStatusCode.Ok);
    return context;
}, HttpMethod.GET, "/resource/[param1]/subresource/[param2]");

Accessing that route via http://localhost:1234/resource/12345/subresource/67890 produces the following error:

The given key was not present in the dictionary.
<br>
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Grapevine.Local.Program.<>c.<Main>b__0_0(IHttpContext context) in C:\source\personal\grapevine\src\Grapevine.Local\Program.cs:line 18
   at Grapevine.Server.Route.Invoke(IHttpContext context) in C:\source\personal\grapevine\src\Grapevine\Server\Route.cs:line 197
   at Grapevine.Server.Router.Route(IHttpContext context, IList`1 routing) in C:\source\personal\grapevine\src\Grapevine\Server\Router.cs:line 580
   at Grapevine.Server.Router.Route(Object state) in C:\source\personal\grapevine\src\Grapevine\Server\Router.cs:line 543

It's expected that all defined parameters are accessible to the route.

@scottoffen scottoffen added this to the 4.0.0.x milestone Jan 11, 2017
MeikTranel added a commit to MeikTranel/Grapevine that referenced this issue Jan 13, 2017
@scottoffen scottoffen self-assigned this Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant