-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
8f3061b
commit 35a1cf1
Showing
3 changed files
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#[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()); | ||
} |