Failed to route empty parameters
See original GitHub issueEmpty parameters aren’t routed properly, expected it to reach the methode. Instead the server returned 500.
Examples
GET /test?var1=
GET /test?var1=example&var2=
// 500 Internal Server Error
// The server failed to handle this request.
I’ve tried allowing null or setting default values, all without luck.
[ResourceMethod(RequestMethod.GET, "test")]
public bool MyMethode(string? var1, string? var2)
[ResourceMethod(RequestMethod.GET, "test")]
public bool MyMethode(string var1 = "", string var2 = "")
Additional Information
- It doesn’t matter how many parameters you have, if one of them is empty then the server returns 500
- From what I can tell this only happens with strings, non null-able types return to their default values.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
SlimPHP route with empty parameter fails
I have a route like this /product/update/{productId}/part/{partId}. If I try to call that with one or more empty parameters, it fails and ...
Read more >Optional route parameters are not yet supported #22342
js whilst old ones staying in CRA until refactored. I've tried to implement this but I'm running into the error below: Optional route...
Read more >Optional route parameter throws error on root path #3663
In the first case, it'd accept routes for both the root path with no parameters, and requests with a single parameter after the...
Read more >ASP0007: Route parameter and argument optionality is ...
Cause. A route parameter is declared as required in the Delegate definition but is marked as optional in the endpoint route. Rule description....
Read more >passing optional parameters to controllers doesn't work
Seems like the default parameter mechanism fails, if I omit the 1st parameter, but provide the second. Is this a known issue, any...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Kaliumhexacyanoferrat Hi, when you find the time, could you check out my proposed solution? I’ll create a pr if this seems acceptable for you.
You’re most welcome, glad to give something back.