Skip to content

Commit d74530f

Browse files
committed
refactor register to pass panic. + 1
1 parent 923513c commit d74530f

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

shenyu-client-rust/src/lib.rs

+2-28
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ mod tests_axum {
388388
use axum::routing::{get, post};
389389
use serde_json::Value;
390390
use std::collections::HashMap;
391-
use tracing::error;
392391

393392
async fn health_handler() -> &'static str {
394393
"OK"
@@ -428,25 +427,8 @@ mod tests_axum {
428427
let res = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 9527);
429428
assert!(&res.is_ok());
430429
let client = &mut res.unwrap();
431-
println!(
432-
"shenyu-client-rust.token: {:?}",
433-
client
434-
.headers
435-
.get("X-Access-Token")
436-
.map(|r| r.clone())
437-
.unwrap_or("None".to_string())
438-
);
439-
440-
if let Ok(token) = client.get_register_token() {
441-
_ = client
442-
.headers
443-
.insert("X-Access-Token".to_string(), token.to_string());
444-
} else {
445-
error!("Can't get register token");
446-
}
447-
client.register_all_metadata(true);
448-
client.register_uri();
449-
client.register_discovery_config();
430+
431+
client.register().unwrap();
450432
client.offline_register();
451433
}
452434

@@ -479,14 +461,6 @@ mod tests_actix_web {
479461
let res = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 9527);
480462
assert!(&res.is_ok());
481463
let client = &mut res.unwrap();
482-
println!(
483-
"shenyu-client-rust.token: {:?}",
484-
client
485-
.headers
486-
.get("X-Access-Token")
487-
.map(|r| r.clone())
488-
.unwrap_or("None".to_string())
489-
);
490464

491465
client.register().unwrap();
492466
client.offline_register();

0 commit comments

Comments
 (0)