Resolve the body override: inline `--body` or `--body-stdin`. Shared by the local body and the service-layer hook — reading the client's stdin is client-side by design, so the routed path resolves the body with this SAME code and sends it on the wire.
(&self)
| 130 | /// client's stdin is client-side by design, so the routed path resolves |
| 131 | /// the body with this SAME code and sends it on the wire. |
| 132 | pub(crate) fn resolve_body(&self) -> CliResult<Option<String>> { |
| 133 | if let Some(ref body) = self.body { |
| 134 | return Ok(Some(body.clone())); |
| 135 | } |
| 136 | if self.body_stdin { |
| 137 | use std::io::Read; |
| 138 | let mut content = String::new(); |
| 139 | std::io::stdin() |
| 140 | .read_to_string(&mut content) |
| 141 | .map_err(CliError::Io)?; |
| 142 | return Ok(Some(content)); |
| 143 | } |
| 144 | Ok(None) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | impl Command for IntentUpdate { |
no test coverage detected