MCPcopy Create free account
hub / github.com/chridou/http-api-problem / into_http_api_problem

Method into_http_api_problem

src/api_error.rs:125–147  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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() {

Callers 3

into_hyper_responseMethod · 0.80
fromMethod · 0.80

Calls 2

detail_messageMethod · 0.80
set_valueMethod · 0.80

Tested by

no test coverage detected