fn ferox_response_serialize_and_deserialize() {
    // deserialize
    let json_response = r#"{"type":"response","url":"https://nerdcore.com/css","path":"/css","wildcard":true,"status":301,"content_length":173,"line_count":10,"word_count":16,"headers":{"server":"nginx/1.16.1"}}"#;
    let response: FeroxResponse = serde_json::from_str(json_response).unwrap();

    assert_eq!(response.url().as_str(), "https://nerdcore.com/css");
    assert_eq!(response.url().path(), "/css");
    assert!(response.wildcard());
    assert_eq!(response.status().as_u16(), 301);
    assert_eq!(response.content_length(), 173);
    assert_eq!(response.line_count(), 10);
    assert_eq!(response.word_count(), 16);
    assert_eq!(response.headers().get("server").unwrap(), "nginx/1.16.1");

    // serialize, however, this can fail when headers are out of order
    let new_json = serde_json::to_string(&response).unwrap();
    assert_eq!(json_response, new_json);
}
/// given a FeroxResponse, test that it serializes into the proper JSON entry
given a FeroxResponse, test that it serializes into the proper JSON entry
given a FeroxResponse test that it serializes into the proper JSON entry
fn ferox_response_serialize_and_deserialize() {
    // deserialize
    let json_response = r#"{"type":"response","url":"https://nerdcore.com/css","path":"/css","wildcard":true,"status":301,"content_length":173,"line_count":10,"word_count":16,"headers":{"server":"nginx/1.16.1"}}"#;
    let response: FeroxResponse = serde_json::from_str(json_response).unwrap();
    assert_eq!(response.url().as_str(), "https://nerdcore.com/css");
    assert_eq!(response.url().path(), "/css");
    assert!(response.wildcard());
    assert_eq!(response.status().as_u16(), 301);
    assert_eq!(response.content_length(), 173);
    assert_eq!(response.line_count(), 10);
    assert_eq!(response.word_count(), 16);
    assert_eq!(response.headers().get("server").unwrap(), "nginx/1.16.1");
    // serialize, however, this can fail when headers are out of order
    let new_json = serde_json::to_string(&response).unwrap();
    assert_eq!(json_response, new_json);
}
fn ferox_response_serialize_and_deserialize ( ) { // deserialize let json_response = r#"{"type":"response","url":"https://nerdcore.com/css","path":"/css","wildcard":true,"status":301,"content_length":173,"line_count":10,"word_count":16,"headers":{"server":"nginx/1.16.1"}}"# ; let response : FeroxResponse = serde_json :: from_str ( json_response ) . unwrap ( ) ; assert_eq ! ( response url ( ) as_str ( ) " " ) ; assert_eq ! ( response url ( ) path ( ) " " ) ; assert ! ( response wildcard ( ) ) ; assert_eq ! ( response status ( ) as_u16 ( ) 301 ) ; assert_eq ! ( response content_length ( ) 173 ) ; assert_eq ! ( response line_count ( ) 10 ) ; assert_eq ! ( response word_count ( ) 16 ) ; assert_eq ! ( response headers ( ) get ( " " ) unwrap ( ) " " ) ; // serialize, however, this can fail when headers are out of order let new_json = serde_json :: to_string ( & response ) . unwrap ( ) ; assert_eq ! ( json_response new_json ) ; }
given a FeroxResponse, test that it serializes into the proper JSON entry
given a FeroxResponse test that it serializes into the proper JSON entry