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 bcc630e commit 6d8df9cCopy full SHA for 6d8df9c
src/status.rs
@@ -123,3 +123,21 @@ pub(crate) mod private {
123
impl<T, E> Sealed for Result<T, E> {}
124
impl<T> Sealed for Option<T> {}
125
}
126
+
127
+#[cfg(test)]
128
+mod test {
129
+ use super::Status;
130
131
+ #[test]
132
+ fn construct_shorthand_with_valid_status_code() {
133
+ let _res = Some(()).status(200).unwrap();
134
+ }
135
136
137
+ #[should_panic(expected = "Could not convert into a valid `StatusCode`")]
138
+ fn construct_shorthand_with_invalid_status_code() {
139
+ let res: Result<(), std::io::Error> =
140
+ Err(std::io::Error::new(std::io::ErrorKind::Other, "oh no!"));
141
+ let _res = res.status(600).unwrap();
142
143
+}
0 commit comments