From 987b275c3fd9b5296f05116b36b1a6cc4d764dea Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 28 Nov 2017 14:29:22 -0800 Subject: [PATCH] add response test --- src/httpresponse.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/httpresponse.rs b/src/httpresponse.rs index 115776718..459c9ba7f 100644 --- a/src/httpresponse.rs +++ b/src/httpresponse.rs @@ -268,7 +268,7 @@ pub struct HttpResponseBuilder { } impl HttpResponseBuilder { - /// Get the HTTP version of this response. + /// Set the HTTP version of this response. #[inline] pub fn version(&mut self, version: Version) -> &mut Self { if let Some(parts) = parts(&mut self.parts, &self.err) { @@ -524,6 +524,16 @@ mod tests { use super::*; use body::Binary; + #[test] + fn test_basic_builder() { + let resp = HttpResponse::Ok() + .status(StatusCode::NO_CONTENT) + .version(Version::HTTP_10) + .finish().unwrap(); + assert_eq!(resp.version(), Some(Version::HTTP_10)); + assert_eq!(resp.status(), StatusCode::NO_CONTENT) + } + #[test] fn test_body() { assert!(Body::Length(10).is_streaming());