httpd: Use `commits`/`commit` instead of `headers`/`header`

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
xphoniex 2023-01-19 14:22:27 +00:00 committed by Alexis Sellier
parent f065bce876
commit 57fbc1ed46
No known key found for this signature in database
1 changed files with 8 additions and 8 deletions

View File

@ -140,7 +140,7 @@ async fn history_handler(
per_page.unwrap_or(30) per_page.unwrap_or(30)
}; };
let headers = repo let commits = repo
.history(&sha)? .history(&sha)?
.filter(|q| { .filter(|q| {
if let Ok(q) = q { if let Ok(q) = q {
@ -170,7 +170,7 @@ async fn history_handler(
.collect(); .collect();
let diff = repo.diff_commit(c.id)?; let diff = repo.diff_commit(c.id)?;
Ok(json!({ Ok(json!({
"header": api::json::commit(&c), "commit": api::json::commit(&c),
"diff": diff, "diff": diff,
"branches": branches "branches": branches
})) }))
@ -179,7 +179,7 @@ async fn history_handler(
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
let response = json!({ let response = json!({
"headers": headers, "commits": commits,
"stats": repo.stats()?, "stats": repo.stats()?,
}); });
@ -209,7 +209,7 @@ async fn commit_handler(
.collect(); .collect();
let response = json!({ let response = json!({
"header": api::json::commit(&commit), "commit": api::json::commit(&commit),
"diff": diff, "diff": diff,
"branches": branches "branches": branches
}); });
@ -521,9 +521,9 @@ mod routes {
assert_eq!( assert_eq!(
response.json().await, response.json().await,
json!({ json!({
"headers": [ "commits": [
{ {
"header": { "commit": {
"sha1": HEAD, "sha1": HEAD,
"author": { "author": {
"name": "Alice Liddell", "name": "Alice Liddell",
@ -573,7 +573,7 @@ mod routes {
] ]
}, },
{ {
"header": { "commit": {
"sha1": HEAD_1, "sha1": HEAD_1,
"author": { "author": {
"name": "Alice Liddell", "name": "Alice Liddell",
@ -647,7 +647,7 @@ mod routes {
assert_eq!( assert_eq!(
response.json().await, response.json().await,
json!({ json!({
"header": { "commit": {
"sha1": HEAD, "sha1": HEAD,
"author": { "author": {
"name": "Alice Liddell", "name": "Alice Liddell",