-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: don't expose hyper HeaderMap #2
Conversation
eventsource-client/src/error.rs
Outdated
let key = key.as_str(); | ||
let value = match value.to_str() { | ||
Ok(value) => value, | ||
Err(err) => return Err(Error::InvalidParameter(Box::new(err))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is still hyper specific no?
Maybe get(&str) -> Result to make this more straightforward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is still hyper specific no?
It's eventsource specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a hyper error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe get(&str) -> Result to make this more straightforward?
Makes the thing kind of painful to use IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if the error is not hyper specific 👍
@spolu Still I think it's not ideal because this error is meant for invalid request params. I'm going to add an |
@@ -58,6 +70,8 @@ pub enum Error { | |||
MalformedLocationHeader(Box<dyn std::error::Error + Send + Sync + 'static>), | |||
/// Reached maximum redirect limit after encountering Location headers. | |||
MaxRedirectLimitReached(u32), | |||
// Invalid response header. | |||
InvalidResponseHeader(Box<dyn std::error::Error + Send + Sync + 'static>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it will fly with them as this list is meant for the main loop no ?
We want our ResponseWrapper to not expose any of the
hyper
types.This commit changes the return value of
headers
to return aHashMap<&str, &str>
instead of ahyper::HeaderMap