question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to route empty parameters

See original GitHub issue

Empty 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:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Fiahbladecommented, Jun 23, 2022

@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.

0reactions
Fiahbladecommented, Jul 3, 2022

You’re most welcome, glad to give something back.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found