diff --git a/Cargo.lock b/Cargo.lock index 08de404..025a769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,7 +183,7 @@ dependencies = [ [[package]] name = "actix-web-utils" -version = "0.2.18" +version = "0.2.19" dependencies = [ "actix-web", "log", diff --git a/Cargo.toml b/Cargo.toml index 96f6f72..99948ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-web-utils" -version = "0.2.18" +version = "0.2.19" edition = "2021" authors = ["Franklin E. Blanco"] description = "Just some useful addons for actix web." diff --git a/src/enums/error.rs b/src/enums/error.rs index 5095ce1..b75b0ce 100644 --- a/src/enums/error.rs +++ b/src/enums/error.rs @@ -40,14 +40,14 @@ impl FromStr for Error { type Err = Error; fn from_str(string: &str) -> Result { - let error_name_option = string.get(14..24); + let error_name_option = string.get(13..25); let error_name_whole = match error_name_option { Some(error_name_whole) => error_name_whole, None => return Err(Error::Unspecified), }; if error_name_whole.starts_with("Unspecified") { return Err(Self::Unspecified) - } else if error_name_whole.starts_with("UnexpectedStatusCode") { + } else if error_name_whole.contains("UnexpectedStatusCode") { let expected_str_index = string.find("Expected: ").unwrap() + 10; let actual_str_index = string.find("Actual: ").unwrap() + 8; let expected_status_code = string.get(expected_str_index..expected_str_index+3).unwrap();