1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

bump version and add some tests

This commit is contained in:
Nikolay Kim 2018-03-07 22:40:46 -08:00
parent 47f01e5b7e
commit 1ab676d7eb
4 changed files with 30 additions and 7 deletions

View File

@ -1,5 +1,8 @@
# Changes
## 0.4.6 (2018-03-xx)
## 0.4.5 (2018-03-07)
* Fix compression #103 and #104
@ -12,8 +15,7 @@
* Better support for `NamedFile` type
* Add `ResponseError` impl for `SendRequestError`.
This improves ergonomics of http client.
* Add `ResponseError` impl for `SendRequestError`. This improves ergonomics of the client.
* Add native-tls support for client

View File

@ -1,6 +1,6 @@
[package]
name = "actix-web"
version = "0.4.5"
version = "0.4.6-dev"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix web is a simple, pragmatic, extremely fast, web framework for Rust."
readme = "README.md"

View File

@ -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"));
}
}

View File

@ -781,7 +781,10 @@ mod tests {
#[test]
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);
assert!(dbg.contains("HttpResponse"));
}
@ -789,8 +792,8 @@ mod tests {
#[test]
fn test_response_cookies() {
let mut headers = HeaderMap::new();
headers.insert(COOKIE,
HeaderValue::from_static("cookie1=value1; cookie2=value2"));
headers.insert(COOKIE, HeaderValue::from_static("cookie1=value1; HttpOnly;"));
headers.insert(COOKIE, HeaderValue::from_static("cookie2=value2; HttpOnly;"));
let req = HttpRequest::new(
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")
.iter().map(|v| v.to_str().unwrap().to_owned()).collect();
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!(
val[1],"name=value; HttpOnly; Path=/test; Domain=www.rust-lang.org; Max-Age=86400");
}