-
-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional url segment #591
Comments
Of course the syntax I was showing was taken from some PHP framework. [Delete("/push/notifMsg/{deviceId}/{notifMsgId?}")]
Task<StatusCountResponse> DeleteNotifMsgs(
Guid? deviceId,
Guid? notificationMsgId = null,
CancellationToken ct); and will issue a call to Anyone? |
I'll pick this up. |
@benjaminhowarth1 |
I could also use this. The workaround for this we use now is an overload: interface MyApi {
[Get("/foo/{bar}")]
GetFoo(string bar);
[Get("/foo/{bar}/{baz}")]
GetFoo(string bar, string baz);
} This can then be 'wrapped' in a class which does a |
Would there be a way to support route definitions with optional segments (as for instance in PHP Slim Framework)?
For instance, if I want to delete say one specific notification message from a user/device or delete all of them I would like to have the following RefitDefinition:
(omitting [Header] parameters for simplicity sake)
Notice the brackets.
The issue right now is that with the only supported definition which is the full one (i.e. without brackets) as:
If say
notificationMsgId
is null, it generates the url as/push/notifMsg/{deviceId}/
i.e. with a trailing slash which gets a 404 response code with php slim-based server code because it is not recognized as a registered valid route.But
/push/notifMsg/{deviceId}
is indeed valid on the server side.Would there be an existing workaround for this use case?
Unless I'm missing the obvious, which is always possible!!
The text was updated successfully, but these errors were encountered: