mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
add response test
This commit is contained in:
parent
932e751240
commit
987b275c3f
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user