aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Steven Pease <peasteven@gmail.com>2019-03-10 12:26:00 -0700
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2019-03-18 10:53:59 +0100
commitd1b47f8908f7ca71da1f767432bb33cb87bbee14 (patch)
tree61241379caf9cff6548b4ec7aca6cfc0c318f5a6 /testing
parent9a12888da65c8a0348634011f496e656ac7e5d8f (diff)
downloadaskama-d1b47f8908f7ca71da1f767432bb33cb87bbee14.tar.gz
askama-d1b47f8908f7ca71da1f767432bb33cb87bbee14.tar.bz2
askama-d1b47f8908f7ca71da1f767432bb33cb87bbee14.zip
Default to UTF-8 mime type for actix-web and gotham
Diffstat (limited to 'testing')
-rw-r--r--testing/tests/actix_web.rs10
-rw-r--r--testing/tests/gotham.rs5
2 files changed, 12 insertions, 3 deletions
diff --git a/testing/tests/actix_web.rs b/testing/tests/actix_web.rs
index 7f2d835..e434ce3 100644
--- a/testing/tests/actix_web.rs
+++ b/testing/tests/actix_web.rs
@@ -18,7 +18,10 @@ fn test_actix_web() {
let request = srv.get().finish().unwrap();
let response = srv.execute(request.send()).unwrap();
assert!(response.status().is_success());
- assert_eq!(response.headers().get(CONTENT_TYPE).unwrap(), "text/html");
+ assert_eq!(
+ response.headers().get(CONTENT_TYPE).unwrap(),
+ "text/html; charset=utf-8"
+ );
let bytes = srv.execute(response.body()).unwrap();
assert_eq!(bytes, Bytes::from_static("Hello, world!".as_ref()));
@@ -36,7 +39,10 @@ fn test_actix_web_responder() {
let request = srv.get().finish().unwrap();
let response = srv.execute(request.send()).unwrap();
assert!(response.status().is_success());
- assert_eq!(response.headers().get(CONTENT_TYPE).unwrap(), "text/html");
+ assert_eq!(
+ response.headers().get(CONTENT_TYPE).unwrap(),
+ "text/html; charset=utf-8"
+ );
let bytes = srv.execute(response.body()).unwrap();
assert_eq!(bytes, Bytes::from_static("Hello, world!".as_ref()));
diff --git a/testing/tests/gotham.rs b/testing/tests/gotham.rs
index f127d59..225a0ef 100644
--- a/testing/tests/gotham.rs
+++ b/testing/tests/gotham.rs
@@ -31,7 +31,10 @@ fn test_gotham() {
let content_type = headers
.get("content-type")
.expect("Response did not contain content-type header");
- assert_eq!(content_type.to_str().unwrap(), mime::TEXT_HTML.to_string());
+ assert_eq!(
+ content_type.to_str().unwrap(),
+ mime::TEXT_HTML_UTF_8.to_string()
+ );
}
let body = res.read_utf8_body().expect("failed to read response body");