httpd: Fix error status code on project not found
It was 500, should be 404.
This commit is contained in:
parent
1b9906db09
commit
5654f08841
|
|
@ -97,6 +97,7 @@ impl IntoResponse for Error {
|
|||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Some(e.message().to_owned()),
|
||||
),
|
||||
Error::Storage(err) if err.is_not_found() => (StatusCode::NOT_FOUND, None),
|
||||
Error::BadRequest(msg) => (StatusCode::BAD_REQUEST, Some(msg)),
|
||||
other => {
|
||||
tracing::error!("Error: {message}");
|
||||
|
|
|
|||
|
|
@ -836,6 +836,15 @@ mod routes {
|
|||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_projects_not_found() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let app = super::router(seed(tmp.path()));
|
||||
let response = get(&app, "/projects/rad:z2u2CP3ZJzB7ZqE8jHrau19yjcfCQ").await;
|
||||
|
||||
assert_eq!(response.status(), StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_projects_commits_root() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in New Issue