1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-27 23:39:03 +02:00

use modern signatures for awc send_* and header methods (#2553)

This commit is contained in:
Rob Ede
2021-12-28 03:22:22 +00:00
committed by GitHub
parent 4616ca8ee6
commit 96a4dc9dec
7 changed files with 52 additions and 162 deletions

View File

@ -7,8 +7,8 @@ use std::{
};
use actix_http::{
error::PayloadError, header, header::HeaderMap, BoxedPayloadStream, Extensions,
HttpMessage, Payload, ResponseHead, StatusCode, Version,
error::PayloadError, header::HeaderMap, BoxedPayloadStream, Extensions, HttpMessage,
Payload, ResponseHead, StatusCode, Version,
};
use actix_rt::time::{sleep, Sleep};
use bytes::Bytes;
@ -119,12 +119,13 @@ impl<S> ClientResponse<S> {
if self.extensions().get::<Cookies>().is_none() {
let mut cookies = Vec::new();
for hdr in self.headers().get_all(&header::SET_COOKIE) {
for hdr in self.headers().get_all(&actix_http::header::SET_COOKIE) {
let s = std::str::from_utf8(hdr.as_bytes()).map_err(CookieParseError::from)?;
cookies.push(Cookie::parse_encoded(s)?.into_owned());
}
self.extensions_mut().insert(Cookies(cookies));
}
Ok(Ref::map(self.extensions(), |ext| {
&ext.get::<Cookies>().unwrap().0
}))