Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(catalog): Debug hook for responses
This doesn't work for two reasons.. 1. We need to use `async` to read the response body. This could be solved by restructuring our client code generation so that we put these functions into the same crate: error[E0658]: async closures are unstable --> catalog-api-v1/src/client.rs:1654:10 | 1654 | (async |_, result: &reqwest::Result<reqwest::Response>| { | ^^^^^ | = note: see issue #62290 <rust-lang/rust#62290> for more information = help: to use an async block, remove the `||`: `async {` 2. Reading a response body takes ownership of the object because the body is read from the wire and can't be re-read again: error[E0507]: cannot move out of `*response` which is behind a shared reference --> catalog-api-v1/src/client.rs:1663:36 | 1663 | let mut body_content = response | ^^^^^^^^ move occurs because `*response` has type `reqwest::Response`, which does not implement the `Copy` trait 1664 | .text() | ------ `*response` moved due to this method call | note: `reqwest::Response::text` takes ownership of the receiver `self`, which moves `*response` --> /Users/dcarley/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.27/src/async_impl/response.rs:147:23 | 147 | pub async fn text(self) -> crate::Result<String> { | ^^^^ error: lifetime may not live long enough --> catalog-api-v1/src/client.rs:1658:65 | 1658 | (async |_, result: &reqwest::Result<reqwest::Response>| { | ____________________________-__________________________________-_^ | | | | | | | return type of closure `{async closure body@catalog-api-v1/src/client.rs:1658:65: 1676:10}` contains a lifetime `'2` | | let's call the lifetime of this reference `'1` 1659 | | let response = result.as_ref().unwrap(); 1660 | | let status = response.status(); 1661 | | let url = response.url().clone(); ... | 1675 | | ); 1676 | | })(&self.inner, &result); | |_________^ returning this value requires that `'1` must outlive `'2`
- Loading branch information