How can I have the Same Request but the Payload is Optional #2724
Unanswered
Carrie0302
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried wrapping the payload in Option and then checking to see if something is there or not, but when trying to match on the payload to see if something is there or not, the None option is never recognized. So for the requests that do have a payload it works fine, but for those with no payload it just ignores it.
I also tried to just have two separate functions, with one that is with a payload and one that does not, but actix does not seem to recognize that they both exist. Is there a way to have the same request with an optional payload?
My first attempt using Option:
infohere prints for every request (payload or not), but inside the match "No payload here" print statement is never hit.
Beta Was this translation helpful? Give feedback.
All reactions