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

Method to_http_api_problem

src/api_error.rs:101–123  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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);

Callers 1

error_responseMethod · 0.80

Calls 2

detail_messageMethod · 0.80
set_valueMethod · 0.80

Tested by

no test coverage detected