Set or update a header - if key exists, update value; otherwise add new
(
&mut self,
key: &str,
value: &str,
window: &mut Window,
cx: &mut Context<Self>,
)
| 165 | CompletionContext::HeaderName, |
| 166 | ) |
| 167 | }); |
| 168 | let completion_engine = self.completion_engine.clone(); |
| 169 | let value_input = cx.new(|cx| { |
| 170 | configure_completion( |
| 171 | InputState::new(window, cx) |
| 172 | .placeholder("Value") |
| 173 | .default_value(&entry.value), |
| 174 | completion_engine.as_ref(), |
| 175 | CompletionContext::HeaderValue, |
| 176 | ) |
| 177 | }); |
| 178 | let description_input = cx.new(|cx| { |
| 179 | InputState::new(window, cx) |
| 180 | .placeholder("Description") |
| 181 | .default_value(&description) |
| 182 | }); |
| 183 | |
| 184 | self.header_rows.push(HeaderRow { |
| 185 | key_input, |
| 186 | value_input, |
| 187 | description_input, |
| 188 | enabled: entry.enabled, |
| 189 | }); |
| 190 | } |
| 191 | } |
| 192 |
no test coverage detected