-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Convert StatusCode
to Status
#1472
Comments
I like it. Does it mean that the status is not the definitive "final" status based on what are the accepted status codes, though? |
Well yeah, that's true. I didn't really consider that. |
You mean using |
Yes it could be like that. But for the problem I've mentioned above it would suffice if the context had |
My thinking was that if we add struct Context {
// Well-known fields
accepted: Option<HashSet<StatusCode>>,
// Arbitrary key-value pairs for customizability
values: HashMap<String, ContextValue>,
} then |
Currently I don't see a possibility to convert a
StatusCode
into aStatus
.It only provides the following function to construct a status code without doing it manually:
So
reqwest::Response
and theaccepted
map are coupled with the creation ofStatus
. It would be better in my opinion ifhttp::StatusCode
was enough to createStatus
. Then a new function could be provided inStatus
to apply an accept map to convert the enum value. This could also be done in a response chain step in the future.I noticed this issue when implementing the FlareSolverr handler where only the status code is available and not a full
reqwest::Response
. In this instance we don't know the accept map and the match statement's logic would have to be copy-pasted.The text was updated successfully, but these errors were encountered: