Optional Path Parameters #397
Answered
by
chrislearn
FallingSnow
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Try <**filename>
… From: "Ayrton ***@***.***>
Date: Sat, Sep 2, 2023, 02:47
Subject: [salvo-rs/salvo] Optional Path Parameters (Discussion #397)
To: ***@***.***>
Cc: ***@***.***>
I couldn't find any examples/documentation on optional path parameters.
I have an endpoint that accepts an optional
filename
parameter but I don't how to tell salvo it is optional.
Router::with_path("api").push(Router::with_path("files/<filename>").handle(storage))
I've tried the follow:
Router::with_path("api").push(Router::with_path("files/<*filename>").handle(storage))
Router::with_path("api").push(Router::with_path("files/<?filename>").handle(storage))
But none of these paths are used when visiting
/api/files
. How do you specify a path parameter is optional?
—
Reply to this email directly, view it on GitHub<#397>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABM2JMDBUX4WWD3XRSQLSX3XYIUSTANCNFSM6AAAAAA4H54OEM>.
You are receiving this because you are subscribed to this thread.[image: https://github.com/notifications/beacon/ABM2JME5XIAIYBUZZTT4HWDXYIUSTA5CNFSM6AAAAAA4H54OEOWGG33NNVSW45C7OR4XAZNKIRUXGY3VONZWS33OVJRW63LNMVXHIX3JMTHAAVJSEI.gif]Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
FallingSnow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I couldn't find any examples/documentation on optional path parameters.
I have an endpoint that accepts an optional
filename
parameter but I don't how to tell salvo it is optional.I've tried the follow:
But none of these paths are used when visiting
/api/files
. How do you specify a path parameter is optional?Beta Was this translation helpful? Give feedback.
All reactions