Skip to content

Commit 2f98ffe

Browse files
authored
refactor(service): 修改状态码参数名为status (#26)
1 parent 53760c3 commit 2f98ffe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/service/src/status_code.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ use tower::Service;
1212

1313
#[make(kind = StatusCode)]
1414
pub struct MakeStatusCodeRouteService {
15-
status_code: u16,
15+
status: u16,
1616
}
1717

1818
impl MakeRouteService for MakeStatusCodeRouteService {
1919
type Service = StatusCodeRouteService;
2020

2121
fn make(&self, args: Args) -> Result<Self::Service, Error> {
2222
Config::with_args(args)
23-
.and_then(|config| StatusCode::from_u16(config.status_code).map_err(Error::new))
23+
.and_then(|config| StatusCode::from_u16(config.status).map_err(Error::new))
2424
.map(StatusCodeRouteService)
2525
}
2626
}

crates/service/tests/status_code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async fn make_with_shortcut() {
4141

4242
#[tokio::test]
4343
async fn make_with_full() {
44-
let value = serde_yaml::from_str::<Value>(r#"status-code: 404"#).unwrap();
44+
let value = serde_yaml::from_str::<Value>(r#"status: 404"#).unwrap();
4545
let args = Args::full(&value);
4646
let service = MakeStatusCodeRouteService.make(args).unwrap();
4747
let status_code = call(service).await;

0 commit comments

Comments
 (0)