use taskfast_client::{take_last_corr, TaskFastClient};
use wiremock::matchers::{method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
#[tokio::test]
async fn post_hook_captures_x_request_id_through_generated_client() {
let server = MockServer::start().await;
Mock::given(method("GET"))
.and(path("/platform/config"))
.respond_with(
ResponseTemplate::new(200)
.insert_header("x-request-id", "req-test-42")
.set_body_json(serde_json::json!({})),
)
.mount(&server)
.await;
let _ = take_last_corr(); let client = TaskFastClient::from_api_key(&server.uri(), "k").expect("client");
let _ = client.inner().get_platform_config().await;
assert_eq!(take_last_corr().as_deref(), Some("req-test-42"));
}