mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
bump version and add some tests
This commit is contained in:
parent
47f01e5b7e
commit
1ab676d7eb
@ -1,5 +1,8 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## 0.4.6 (2018-03-xx)
|
||||||
|
|
||||||
|
|
||||||
## 0.4.5 (2018-03-07)
|
## 0.4.5 (2018-03-07)
|
||||||
|
|
||||||
* Fix compression #103 and #104
|
* Fix compression #103 and #104
|
||||||
@ -12,8 +15,7 @@
|
|||||||
|
|
||||||
* Better support for `NamedFile` type
|
* Better support for `NamedFile` type
|
||||||
|
|
||||||
* Add `ResponseError` impl for `SendRequestError`.
|
* Add `ResponseError` impl for `SendRequestError`. This improves ergonomics of the client.
|
||||||
This improves ergonomics of http client.
|
|
||||||
|
|
||||||
* Add native-tls support for client
|
* Add native-tls support for client
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "0.4.5"
|
version = "0.4.6-dev"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix web is a simple, pragmatic, extremely fast, web framework for Rust."
|
description = "Actix web is a simple, pragmatic, extremely fast, web framework for Rust."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -129,3 +129,20 @@ impl Stream for ClientResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_debug() {
|
||||||
|
let resp = ClientResponse::new(ClientMessage::default());
|
||||||
|
resp.as_mut().headers.insert(
|
||||||
|
header::COOKIE, HeaderValue::from_static("cookie1=value1"));
|
||||||
|
resp.as_mut().headers.insert(
|
||||||
|
header::COOKIE, HeaderValue::from_static("cookie2=value2"));
|
||||||
|
|
||||||
|
let dbg = format!("{:?}", resp);
|
||||||
|
assert!(dbg.contains("ClientResponse"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -781,7 +781,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_debug() {
|
fn test_debug() {
|
||||||
let resp = HttpResponse::Ok().finish().unwrap();
|
let resp = HttpResponse::Ok()
|
||||||
|
.header(COOKIE, HeaderValue::from_static("cookie1=value1; "))
|
||||||
|
.header(COOKIE, HeaderValue::from_static("cookie2=value2; "))
|
||||||
|
.finish().unwrap();
|
||||||
let dbg = format!("{:?}", resp);
|
let dbg = format!("{:?}", resp);
|
||||||
assert!(dbg.contains("HttpResponse"));
|
assert!(dbg.contains("HttpResponse"));
|
||||||
}
|
}
|
||||||
@ -789,8 +792,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_response_cookies() {
|
fn test_response_cookies() {
|
||||||
let mut headers = HeaderMap::new();
|
let mut headers = HeaderMap::new();
|
||||||
headers.insert(COOKIE,
|
headers.insert(COOKIE, HeaderValue::from_static("cookie1=value1; HttpOnly;"));
|
||||||
HeaderValue::from_static("cookie1=value1; cookie2=value2"));
|
headers.insert(COOKIE, HeaderValue::from_static("cookie2=value2; HttpOnly;"));
|
||||||
|
|
||||||
let req = HttpRequest::new(
|
let req = HttpRequest::new(
|
||||||
Method::GET, Uri::from_str("/").unwrap(), Version::HTTP_11, headers, None);
|
Method::GET, Uri::from_str("/").unwrap(), Version::HTTP_11, headers, None);
|
||||||
@ -813,7 +816,8 @@ mod tests {
|
|||||||
let mut val: Vec<_> = resp.headers().get_all("Set-Cookie")
|
let mut val: Vec<_> = resp.headers().get_all("Set-Cookie")
|
||||||
.iter().map(|v| v.to_str().unwrap().to_owned()).collect();
|
.iter().map(|v| v.to_str().unwrap().to_owned()).collect();
|
||||||
val.sort();
|
val.sort();
|
||||||
assert!(val[0].starts_with("cookie1=; Max-Age=0;"));
|
println!("{:?}", val);
|
||||||
|
assert!(val[0].starts_with("cookie2=; HttpOnly; Max-Age=0;"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
val[1],"name=value; HttpOnly; Path=/test; Domain=www.rust-lang.org; Max-Age=86400");
|
val[1],"name=value; HttpOnly; Path=/test; Domain=www.rust-lang.org; Max-Age=86400");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user