(self)
| 123 | } |
| 124 | |
| 125 | pub fn into_http_api_problem(self) -> HttpApiProblem { |
| 126 | let mut problem = HttpApiProblem::with_title_and_type_from_status(self.status); |
| 127 | |
| 128 | if let Some(detail_message) = self.detail_message() { |
| 129 | problem.detail = Some(detail_message.to_string()) |
| 130 | } |
| 131 | |
| 132 | if let Some(custom_type_url) = self.type_url { |
| 133 | problem.type_url = Some(custom_type_url) |
| 134 | } |
| 135 | |
| 136 | if self.status != StatusCode::UNAUTHORIZED { |
| 137 | for (key, value) in self.fields.into_iter() { |
| 138 | let _ = problem.set_value(key, &value); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | if let Some(title) = self.title { |
| 143 | problem.title = title; |
| 144 | } |
| 145 | |
| 146 | problem |
| 147 | } |
| 148 | |
| 149 | fn detail_message(&self) -> Option<Cow<str>> { |
| 150 | if let Some(message) = self.message.as_ref() { |
no test coverage detected