addon_transport: must error out when there is no manifest.json
use crate::state_types::{EnvFuture, Environment, Request};
use crate::types::addons::*;
use std::marker::PhantomData;
+use futures::future::err;
mod legacy;
use self::legacy::AddonLegacyTransport;
@@ -32,6 +33,10 @@ impl<T: Environment> AddonInterface for AddonHTTPTransport<T> {
return AddonLegacyTransport::<T>::from_url(&self.transport_url).get(&path);
}
+ if !self.transport_url.ends_with(MANIFEST_PATH) {
+ return Box::new(err(format!("transport_url must end in {}", MANIFEST_PATH).into()));
+ }
+
let url = self.transport_url.replace(MANIFEST_PATH, &path.to_string());
let r = Request::get(&url).body(()).expect("builder cannot fail");
T::fetch_serde::<_, ResourceResponse>(r)
