forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits

compression_route_tests.rs25 lines, 889 bytesHistoryRawDownload
1//! The public router gzips its stylesheet. The response compression policy is tested in
2//! forge-web-base, next to the layer; this checks it is wired into the real app router.
3
4use http::header::{ACCEPT_ENCODING, CONTENT_ENCODING};
5use topcoat::router::Body;
6
7#[tokio::test]
8async fn public_css_asset_is_gzipped() {
9 let dir = tempfile::tempdir().expect("tempdir");
10 let state = crate::test_support::test_state(dir.path()).await;
11 let router = crate::test_support::app_router(state);
12 let request = http::Request::builder()
13 .uri("/assets/main.css")
14 .header(ACCEPT_ENCODING, "gzip")
15 .body(Body::empty())
16 .expect("request");
17 let response = router.handle(request).await;
18 assert_eq!(
19 response
20 .headers()
21 .get(CONTENT_ENCODING)
22 .map(|v| v.to_str().expect("ascii")),
23 Some("gzip")
24 );
25}