Skip to content

Commit 9c62862

Browse files
committed
Add test case for bytes endpoint
1 parent 1033b9d commit 9c62862

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/dynamic_data.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,17 @@ mod test {
161161
assert_eq!(resp.get_content_type(), Some(mime::APPLICATION_JSON));
162162
assert_eq!(resp.into_body_str().as_str(), "foobar");
163163
}
164+
165+
#[test]
166+
fn test_bytes() {
167+
let req = &Request::from_client()
168+
.with_path("/bytes/42");
169+
let resp = bytes(req);
170+
assert!(resp.is_ok());
171+
let resp = resp.unwrap();
172+
assert_eq!(resp.get_status(), StatusCode::OK);
173+
assert_eq!(resp.get_content_type(), Some(mime::APPLICATION_OCTET_STREAM));
174+
let body = resp.into_body_bytes();
175+
assert_eq!(body.len(), 42);
176+
}
164177
}

0 commit comments

Comments
 (0)