Skip to content

Commit 0a30e8e

Browse files
committed
Fix a few typos
Also make the response for an invalid JSON request body a 400 instead of a 200 HTTP status code.
1 parent e66bfda commit 0a30e8e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/controllers/user/me.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub fn update_email_notifications(req: &mut dyn Request) -> CargoResult<Response
246246
let mut body = String::new();
247247
req.body().read_to_string(&mut body)?;
248248
let updates: HashMap<i32, bool> = serde_json::from_str::<Vec<CrateEmailNotifications>>(&body)
249-
.map_err(|_| human("invalid json request"))?
249+
.map_err(|_| bad_request("invalid json request"))?
250250
.iter()
251251
.map(|c| (c.id, c.email_notifications))
252252
.collect();

src/tests/user.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ fn test_existing_user_email() {
592592
}
593593

594594
/* A user should be able to update the email notifications for crates they own. Only the crates that
595-
were sent in the request should be updated the the corresponding `email_notifications` value.
595+
were sent in the request should be updated to the corresponding `email_notifications` value.
596596
*/
597597
#[test]
598598
fn test_update_email_notifications() {
@@ -678,7 +678,7 @@ fn test_update_email_notifications() {
678678
}
679679

680680
/* A user should not be able to update the `email_notifications` value for a crate that is not
681-
owend by them.
681+
owned by them.
682682
*/
683683
#[test]
684684
fn test_update_email_notifications_not_owned() {

0 commit comments

Comments
 (0)