CookieStore cleanup/fixes
* Remove TODO * Remove Cookie::set_ setters * Do not expose SameSite enum, provide getters on Cookie instead * Simplify Response::cookies signature (now ignores errors)
This commit is contained in:
committed by
Sean McArthur
parent
954fdfae30
commit
9935a8e117
@@ -546,7 +546,6 @@ impl Client {
|
||||
.collect::<Vec<_>>()
|
||||
.join("; ");
|
||||
if !header.is_empty() {
|
||||
// TODO: is it safe to unwrap here? Investigate if Cookie content is always valid.
|
||||
headers.insert(::header::COOKIE, HeaderValue::from_bytes(header.as_bytes()).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,10 +71,11 @@ impl Response {
|
||||
}
|
||||
|
||||
/// Retrieve the cookies contained in the response.
|
||||
pub fn cookies<'a>(&'a self) -> impl Iterator<
|
||||
Item = Result<cookie::Cookie<'a>, cookie::CookieParseError>
|
||||
> + 'a {
|
||||
///
|
||||
/// Note that invalid 'Set-Cookie' headers will be ignored.
|
||||
pub fn cookies<'a>(&'a self) -> impl Iterator<Item = cookie::Cookie<'a>> + 'a {
|
||||
cookie::extract_response_cookies(&self.headers)
|
||||
.filter_map(Result::ok)
|
||||
}
|
||||
|
||||
/// Get the final `Url` of this `Response`.
|
||||
|
||||
Reference in New Issue
Block a user