Reduce number of unwwaps in api crate (#2681)

* Reduce number of unwwaps in api crate

* Format use section
This commit is contained in:
hashmap
2019-03-18 19:34:35 +01:00
committed by GitHub
parent 2b218f2dc3
commit 7fad5b040f
17 changed files with 165 additions and 123 deletions
+5 -3
View File
@@ -16,7 +16,9 @@
//! invocations) as needed.
//! Still experimental
use crate::adapters::{FileWalletCommAdapter, HTTPWalletCommAdapter, KeybaseWalletCommAdapter};
use crate::api::{ApiServer, BasicAuthMiddleware, Handler, ResponseFuture, Router, TLSConfig};
use crate::api::{
ApiServer, BasicAuthMiddleware, Handler, ResponseFuture, Router, TLSConfig, GRIN_BASIC_REALM,
};
use crate::core::core;
use crate::core::core::Transaction;
use crate::keychain::Keychain;
@@ -89,8 +91,8 @@ where
if api_secret.is_some() {
let api_basic_auth =
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret.unwrap()));
let basic_realm = "Basic realm=GrinOwnerAPI".to_string();
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(api_basic_auth, basic_realm));
let basic_auth_middleware =
Arc::new(BasicAuthMiddleware::new(api_basic_auth, &GRIN_BASIC_REALM));
router.add_middleware(basic_auth_middleware);
}
router
+1 -1
View File
@@ -75,7 +75,7 @@ fn get_outputs_by_pmmr_index_local(
outputs: outputs
.2
.iter()
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true))
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true).unwrap())
.collect(),
}
}