We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e498f35 commit 99cf7abCopy full SHA for 99cf7ab
rust/signed_doc/src/metadata/content_type.rs
@@ -112,4 +112,24 @@ mod tests {
112
assert!(ContentType::Json.validate(&cbor_bytes).is_err());
113
assert!(ContentType::Cbor.validate(&cbor_bytes).is_ok());
114
}
115
+
116
+ #[test]
117
+ fn content_type_string_test() {
118
+ assert_eq!(
119
+ ContentType::from_str("application/cbor").unwrap(),
120
+ ContentType::Cbor
121
+ );
122
123
+ ContentType::from_str("application/json").unwrap(),
124
+ ContentType::Json
125
126
127
+ "application/cbor".parse::<ContentType>().unwrap(),
128
129
130
131
+ "application/json".parse::<ContentType>().unwrap(),
132
133
134
+ }
135
0 commit comments