mirror of
https://github.com/actix/actix-web.git
synced 2025-02-20 12:56:16 +00:00
add response test
This commit is contained in:
parent
932e751240
commit
987b275c3f
1 changed files with 11 additions and 1 deletions
|
@ -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…
Reference in a new issue