You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that adding an Option to the return type forces the consumer to have an extra level of matching for no gained benefit (in my personal opinion).
If I am trying to parse a body and there is no body present, I would argue that it should be an Err, instead of being Ok(None), after all, I was expected a value to be there that is missing. You can add MissingBody as a potential error code.
I believe this would simplify the API and make it easier to consume.
If the maintainers of this repo agree with my proposal, I can go ahead and submit a PR.
Thanks.
The text was updated successfully, but these errors were encountered:
Currently body parser works by returning a
Result<Option>
:I believe that adding an Option to the return type forces the consumer to have an extra level of matching for no gained benefit (in my personal opinion).
If I am trying to parse a body and there is no body present, I would argue that it should be an Err, instead of being
Ok(None)
, after all, I was expected a value to be there that is missing. You can addMissingBody
as a potential error code.I believe this would simplify the API and make it easier to consume.
If the maintainers of this repo agree with my proposal, I can go ahead and submit a PR.
Thanks.
The text was updated successfully, but these errors were encountered: