You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let body = r#"{"ip_registry_id":"C1","ip_ids":[10,11],"seller":"G1","prices":[100,200],"buyer":"G2","token":"C2","idempotency_key":"batch-init-test-key"}"#;
638
+
let send = || {
639
+
app.clone().oneshot(
640
+
Request::builder()
641
+
.method("POST")
642
+
.uri("/v1/swap/bulk/initiate")
643
+
.header("content-type","application/json")
644
+
.body(Body::from(body.to_string()))
645
+
.unwrap(),
646
+
)
647
+
};
648
+
649
+
let first = send().await.unwrap();
650
+
let second = send().await.unwrap();
651
+
assert_eq!(first.status(),StatusCode::OK);
652
+
assert_eq!(second.status(),StatusCode::OK);
653
+
654
+
let parse_ids = |resp: axum::response::Response| {
655
+
asyncmove{
656
+
let body = axum::body::to_bytes(resp.into_body(), usize::MAX).await.unwrap();
657
+
let json: serde_json::Value = serde_json::from_slice(&body).unwrap();
658
+
json["swap_ids"]
659
+
.as_array()
660
+
.unwrap()
661
+
.iter()
662
+
.map(|id| id.as_u64().unwrap())
663
+
.collect::<Vec<u64>>()
664
+
}
665
+
};
666
+
667
+
let first_ids = parse_ids(first).await;
668
+
let second_ids = parse_ids(second).await;
669
+
assert_eq!(first_ids.len(),2);
670
+
// #523: replay with the same key must return the cached swap IDs.
671
+
assert_eq!(first_ids, second_ids);
672
+
}
673
+
533
674
// ── #319: API Versioning tests ────────────────────────────────────────────
0 commit comments