dotnet / dotnet/aspnetcore

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

Open
#30,661 5 comments 1 reaction 0 assignees View on GitHub
area-mvc feature-routing
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Describe the bug

Supposed I have the following action in the controller:

```C#
[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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.