Skip to content

whitespace between parameters in the request can not match the route template #30661

Open
@xuzhg

Description

@xuzhg

Describe the bug

Supposed I have the following action in the controller:

[HttpGet("GetProductPrices(organizationId={organizationId},partId={partId})")]
public IActionResult GetPrice(string organizationId, string partId)
{
   // ....
}

The following request works fine:

https://{{url}}/GetProductPrices(organizationId='10001',partId='100000-01')  <-- Working 

The following request can't work. (Be noted, there's a whitespace between parameters)

https://{{url}}/GetProductPrice(organizationId='10001', partId='100000-01')  <-- This does not work and gets a 404 Not Found response

I'd like to learn :

  1. GetProductPrices(organizationId={organizationId},partId={partId}) is correct pattern?
  2. A whitespace between parameters is not allowed?
  3. If I put a whitespace between route template, For example, GetProductPrices(organizationId={organizationId}, partId={partId}), we have to match the whitespace in the request URI?

Activity

added
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
on Mar 4, 2021
added this to the Discussions milestone on Mar 8, 2021
xuzhg

xuzhg commented on Mar 22, 2021

@xuzhg
Author

More suggestion:

Can we support the different order for the function parameter from ASP.NET Core?

https://{{url}}/GetProductPrices(organizationId='10001',partId='100000-01')

&

https://{{url}}/GetProductPrices(partId='100000-01',organizationId='10001')

can both match the GetProductPrices(organizationId={organizationId},partId={partId}) pattern?

ghost
ghost closed this as completedon May 22, 2021
ghost
ghost closed this as completedon Jul 23, 2021
ghost
ghost closed this as completedon Sep 21, 2021
removed this from the Discussions milestone on Sep 22, 2021

6 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-routing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      whitespace between parameters in the request can not match the route template · Issue #30661 · dotnet/aspnetcore