Remove trailing newline from testing response
The newline becomes part of the response body, even though it was not passed in as `body`, which makes `Response::new` difficult to use with anything that checksums data contents for example. Arguably there should also be a mechanism for passing in `[u8]` bodies, but that's for a separate feature request.
This commit is contained in:
committed by
Martin Algesten
parent
535bc4b4cb
commit
1ec60e1c15
@@ -109,7 +109,7 @@ impl Response {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn new(status: u16, status_text: &str, body: &str) -> Result<Response, Error> {
|
||||
let r = format!("HTTP/1.1 {} {}\r\n\r\n{}\n", status, status_text, body);
|
||||
let r = format!("HTTP/1.1 {} {}\r\n\r\n{}", status, status_text, body);
|
||||
(r.as_ref() as &str).parse()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user