feat(utas-host): send X-OpenFUT-Game to Core + end-to-end /club composition test
This commit is contained in:
@@ -118,16 +118,21 @@ pub trait CoreAccess: Send + Sync {
|
||||
}
|
||||
|
||||
/// Default HTTP implementation: `GET {core_url}/collection?…` (plain HTTP JSON,
|
||||
/// the same boundary Bridge uses to reach Core).
|
||||
/// the same boundary Bridge uses to reach Core). Every request carries
|
||||
/// `X-OpenFUT-Game: <game>` so Core resolves the game-scoped active profile — for
|
||||
/// FIFA 17 that is the profile whose inventory is fully asset-mapped, so `/club`
|
||||
/// filters/paginates a wholly renderable set (no post-pagination drops).
|
||||
pub struct HttpCoreClient {
|
||||
base_url: String,
|
||||
game: String,
|
||||
client: reqwest::blocking::Client,
|
||||
}
|
||||
|
||||
impl HttpCoreClient {
|
||||
pub fn new(base_url: impl Into<String>) -> Self {
|
||||
pub fn new(base_url: impl Into<String>, game: impl Into<String>) -> Self {
|
||||
HttpCoreClient {
|
||||
base_url: base_url.into().trim_end_matches('/').to_string(),
|
||||
game: game.into(),
|
||||
client: reqwest::blocking::Client::new(),
|
||||
}
|
||||
}
|
||||
@@ -139,6 +144,7 @@ impl CoreAccess for HttpCoreClient {
|
||||
let resp = self
|
||||
.client
|
||||
.get(&url)
|
||||
.header("X-OpenFUT-Game", &self.game)
|
||||
.query(params)
|
||||
.send()
|
||||
.map_err(|e| CoreError::Http(e.to_string()))?;
|
||||
@@ -507,7 +513,10 @@ impl Server {
|
||||
let assets: Arc<dyn ItemIdentityResolver + Send + Sync> =
|
||||
Arc::new(Fifa17IdentityResolver::new(catalog, Arc::new(store)));
|
||||
Ok(Server {
|
||||
core: Arc::new(HttpCoreClient::new(cfg.core_url.clone())),
|
||||
core: Arc::new(HttpCoreClient::new(
|
||||
cfg.core_url.clone(),
|
||||
Fifa17WireItemIdPolicy::GAME,
|
||||
)),
|
||||
entities: Arc::new(entities),
|
||||
assets,
|
||||
pass: Arc::new(PassClient::new(cfg.python_upstream.clone())),
|
||||
|
||||
Reference in New Issue
Block a user