feat(import): resolve references and schema composition
This commit is contained in:
@@ -6,6 +6,7 @@ use std::{
|
||||
Arc,
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use axum::{
|
||||
@@ -14,7 +15,9 @@ use axum::{
|
||||
http::StatusCode,
|
||||
routing::{any, post},
|
||||
};
|
||||
use crank_adapter_rest::{OutboundHttpPolicy, RestAdapter, RestAdapterError, RestRequest};
|
||||
use crank_adapter_rest::{
|
||||
ExternalReferenceFetcher, OutboundHttpPolicy, RestAdapter, RestAdapterError, RestRequest,
|
||||
};
|
||||
use crank_core::{HttpMethod, ProtocolAdapterError, RestTarget};
|
||||
use serde_json::{Value, json};
|
||||
use tokio::net::TcpListener;
|
||||
@@ -94,7 +97,7 @@ async fn proxy_environment_is_ignored_by_default() {
|
||||
let adapter = RestAdapter::default();
|
||||
let request = json_request(json!({"payload": "proxy-env-canary"}));
|
||||
let rest_target = RestTarget {
|
||||
base_url: target,
|
||||
base_url: target.clone(),
|
||||
method: HttpMethod::Post,
|
||||
path_template: "/capture".to_owned(),
|
||||
static_headers: BTreeMap::new(),
|
||||
@@ -102,6 +105,17 @@ async fn proxy_environment_is_ignored_by_default() {
|
||||
let _ = adapter.execute(&rest_target, &request).await.expect_err(
|
||||
"unresolvable target should fail locally instead of being sent through proxy env",
|
||||
);
|
||||
let fetcher = ExternalReferenceFetcher::try_new(
|
||||
OutboundHttpPolicy::default(),
|
||||
vec!["http://public.example.test/".to_owned()],
|
||||
1024,
|
||||
Duration::from_secs(1),
|
||||
)
|
||||
.expect("valid external reference fetcher");
|
||||
let _ = fetcher
|
||||
.get(&target)
|
||||
.await
|
||||
.expect_err("external reference fetcher must not use proxy environment variables");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user