(&self)
| 99 | } |
| 100 | |
| 101 | pub fn to_http_api_problem(&self) -> HttpApiProblem { |
| 102 | let mut problem = HttpApiProblem::with_title_and_type_from_status(self.status); |
| 103 | |
| 104 | if let Some(detail_message) = self.detail_message() { |
| 105 | problem.detail = Some(detail_message.to_string()) |
| 106 | } |
| 107 | |
| 108 | if let Some(custom_type_url) = self.type_url.as_ref() { |
| 109 | problem.type_url = Some(custom_type_url.to_string()) |
| 110 | } |
| 111 | |
| 112 | if self.status != StatusCode::UNAUTHORIZED { |
| 113 | for (key, value) in self.fields.iter() { |
| 114 | let _ = problem.set_value(key.to_string(), value); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | if let Some(title) = self.title.as_ref() { |
| 119 | problem.title = title.to_owned(); |
| 120 | } |
| 121 | |
| 122 | problem |
| 123 | } |
| 124 | |
| 125 | pub fn into_http_api_problem(self) -> HttpApiProblem { |
| 126 | let mut problem = HttpApiProblem::with_title_and_type_from_status(self.status); |
no test coverage detected