mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 09:59:21 +02:00
cleanup
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
//! Pieces pertaining to the HTTP response.
|
||||
use std::{io, mem, str, fmt};
|
||||
use std::{mem, str, fmt};
|
||||
use std::convert::Into;
|
||||
|
||||
use cookie::CookieJar;
|
||||
@ -157,17 +157,6 @@ impl HttpResponse {
|
||||
self.chunked
|
||||
}
|
||||
|
||||
/// Enables automatic chunked transfer encoding
|
||||
pub fn enable_chunked_encoding(&mut self) -> Result<(), io::Error> {
|
||||
if self.headers.contains_key(header::CONTENT_LENGTH) {
|
||||
Err(io::Error::new(io::ErrorKind::Other,
|
||||
"You can't enable chunked encoding when a content length is set"))
|
||||
} else {
|
||||
self.chunked = true;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Content encoding
|
||||
pub fn content_encoding(&self) -> &ContentEncoding {
|
||||
&self.encoding
|
||||
@ -597,6 +586,7 @@ mod tests {
|
||||
fn test_basic_builder() {
|
||||
let resp = HttpResponse::Ok()
|
||||
.status(StatusCode::NO_CONTENT)
|
||||
.header("X-TEST", "value")
|
||||
.version(Version::HTTP_10)
|
||||
.finish().unwrap();
|
||||
assert_eq!(resp.version(), Some(Version::HTTP_10));
|
||||
|
Reference in New Issue
Block a user