mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 13:51:50 +01:00
add response test
This commit is contained in:
parent
932e751240
commit
987b275c3f
@ -268,7 +268,7 @@ pub struct HttpResponseBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HttpResponseBuilder {
|
impl HttpResponseBuilder {
|
||||||
/// Get the HTTP version of this response.
|
/// Set the HTTP version of this response.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn version(&mut self, version: Version) -> &mut Self {
|
pub fn version(&mut self, version: Version) -> &mut Self {
|
||||||
if let Some(parts) = parts(&mut self.parts, &self.err) {
|
if let Some(parts) = parts(&mut self.parts, &self.err) {
|
||||||
@ -524,6 +524,16 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use body::Binary;
|
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]
|
#[test]
|
||||||
fn test_body() {
|
fn test_body() {
|
||||||
assert!(Body::Length(10).is_streaming());
|
assert!(Body::Length(10).is_streaming());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user