Skip to content

Commit

Permalink
Breaking change: Updating a non-existent record should return HTTP er…
Browse files Browse the repository at this point in the history
…ror 404 and not 400

This fixes #378
  • Loading branch information
QuantumDancer committed Aug 7, 2023
1 parent 5bc1e2e commit 414c3e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion auditor/src/routes/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum UpdateError {
debug_for_error!(UpdateError);
responseerror_for_error!(
UpdateError,
UnknownRecord => BAD_REQUEST;
UnknownRecord => NOT_FOUND;
UnexpectedError => INTERNAL_SERVER_ERROR;
);

Expand Down
4 changes: 2 additions & 2 deletions auditor/tests/api/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use auditor::domain::{Component, Record, RecordDatabase, RecordTest};
use fake::{Fake, Faker};

#[tokio::test]
async fn update_returns_a_400_for_non_existing_record() {
async fn update_returns_a_404_for_non_existing_record() {
// Arange
let app = spawn_app().await;
let client = reqwest::Client::new();
Expand All @@ -19,7 +19,7 @@ async fn update_returns_a_400_for_non_existing_record() {
.await
.expect("Failed to execute request.");

assert_eq!(400, response.status().as_u16());
assert_eq!(404, response.status().as_u16());
}

#[tokio::test]
Expand Down

0 comments on commit 414c3e1

Please sign in to comment.