Skip to content
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

make IntoResponse implementation more intuitive #472

Open
msrd0 opened this issue Sep 5, 2020 · 1 comment
Open

make IntoResponse implementation more intuitive #472

msrd0 opened this issue Sep 5, 2020 · 1 comment

Comments

@msrd0
Copy link
Member

msrd0 commented Sep 5, 2020

As of right now, the IntoResponse for Result<T, E> just calls the IntoResponse implementation for either type. This is fine in most use cases, but is counter-intuitive when Err("API Error") generates a 200 response.

Reported by @tanriol on gitter.

@msrd0 msrd0 added this to the 0.6 milestone Sep 5, 2020
@nyarly
Copy link
Contributor

nyarly commented Oct 20, 2020

I'd agree to this in general, but I wonder if it isn't a symptom of the "Into" happening at the wrong level. If e.g. we took a Result and produced a HandlerResult, then the Err branch there is clearly a non-success status (default to 500?).

Alternatively, IntoReponse for Errors shouldn't produce a 200, unless set explicitly.

@msrd0 msrd0 removed this from the 0.6 milestone Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants