Rocket/core/lib/tests/content-length.rs
Tau 35a1cf12b6 Fix and always set Content-Length header.
Previously, the header was erroneously set as 'Content-Type' and not
visible to local clients. This commit fixes both of these issues.
2024-03-21 16:42:09 -07:00

16 lines
390 B
Rust

#[macro_use]
extern crate rocket;
#[get("/")]
fn index() -> String {
"Hello, world!".into()
}
#[test]
fn content_length_header() {
let rocket = rocket::build().mount("/", routes![index]);
let client = rocket::local::blocking::Client::debug(rocket).unwrap();
let response = client.get("/").dispatch();
assert!(response.headers().get_one("Content-Length").is_some());
}