LukeMathWalker / LukeMathWalker/zero-to-production

newsletter::newsletter_creation_is_idempotent at the end of 11.8 does not actually work

Open
#236 0 comments 7 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.5k
Forks
585
PR merge metrics
No merged PRs in 30d

Description

The test requires that the repeated response have a flash message, which is not in fact in the code; I had to add it like so:

```
// Return early if we have a saved response in the database
if let Some(saved_response) = get_saved_response(&pool, &idempotency_key, *user_id)
.await
.map_err(e500)?
{
FlashMessage::info("The newsletter issue has been published!").send();
return Ok(saved_response);
}
```

I believe this is the same method that https://github.com/LukeMathWalker/zero-to-production/blob/root-chapter-11/src/routes/admin/newsletter/post.rs#L50 uses later in the chapter.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the newsletter::newsletter_creation_is_idempotent test at the end of chapter 11.8 and compare it with root-chapter-11/src/routes/admin/newsletter/post.rs around line 50. Verify the repeated request behavior and confirm that the test and implementation agree about the flash message and saved response.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.