Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.
This repository was archived by the owner on May 19, 2024. It is now read-only.

RoutePrefix parameter is not recognized #66

@TerraVenil

Description

@TerraVenil

Hi. I have a very simple routing for Web Api


[RoutePrefix("api/v1/{id}")]
public class SomeController : ApiController
{
    [Route("values")]
    public someValues Get(int id) { }
}
_config.ShouldMap("/api/v1/1/values").To(HttpMethod.Get, x => x.Get(1));

and I have exception MvcRouteTester.Assertions.AssertionExceptionExpected '1', got missing value for 'id' at url '/api/v1/1/values' . After some debugging I found that expected and actual route values different only by one property! This property was RouteValueOrigin. For actual values it's equal to RouteValueOrigin.Params BUT for expected value it was RouteValueOrigin.Unknown from that strange line


var routeValueOrigin = isFromBody ? RouteValueOrigin.Body : RouteValueOrigin.Unknown;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions