#[cfg(test)]
pub mod common;
#[cfg(test)]
mod root_tests {
use http::{Response, HttpError, HttpScheme};
#[test]
fn test_parse_status_code_response() {
{
let resp = Response::new(
1,
vec![(b":status".to_vec(), b"200".to_vec())],
vec![]);
assert_eq!(resp.status_code().ok().unwrap(), 200);
}
{
let resp = Response::new(
1,
vec![(b":status".to_vec(), b"200".to_vec()),
(b"key".to_vec(), b"val".to_vec())],
vec![]);
assert_eq!(resp.status_code().ok().unwrap(), 200);
}
{
let resp = Response::new(
1,
vec![(b"key".to_vec(), b"val".to_vec()),
(b":status".to_vec(), b"200".to_vec())],
vec![]);
assert_eq!(resp.status_code().err().unwrap(),
HttpError::MalformedResponse);
}
{
let resp = Response::new(1, vec![], vec![]);
assert_eq!(resp.status_code().err().unwrap(),
HttpError::MalformedResponse);
}
}
#[test]
fn test_scheme_string() {
assert_eq!(HttpScheme::Http.as_bytes(), b"http");
assert_eq!(HttpScheme::Https.as_bytes(), b"https");
}
#[test]
fn _assert_error_is_sync_send() {
fn _is_sync_send<T: Sync + Send>() {}
_is_sync_send::<HttpError>();
}
}