mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 00:35:51 +03:00
[GH-ISSUE #206] Add support for search query params to /latest endpoints #136
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @matchai on GitHub (Nov 9, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/206
When testing with emails, I'll often want to pull up the latest email sent by my test runner, but with tests running in parallel,
/latest.htmlcan bring about race conditions, showing the wrong email.By allowing
/latestendpoints to support search-like query params, I can avoid these race conditions by filtering by the sender or recipient, which can be unique per test.@axllent commented on GitHub (Nov 10, 2023):
Hi @matchai. I understand the issue you are having with a race condition. You can actually do this already, although it uses two API calls:
/api/v1/search?query=<query>&limit=1would return the latest message summary (JSON array) matching your query. This summary would include the databaseIDof the message.ID, you could then fetch/view/<ID>.htmlDoes this not do what you are trying to achieve?
@matchai commented on GitHub (Nov 10, 2023):
That totally works. As a presumably common use-case, it would be great to have a convenient way to do it at once.
No worries though if you consider it to be out of scope for the project ☺️
@axllent commented on GitHub (Nov 11, 2023):
@matchai I have just added this feature in v1.10.0. You can find more info on https://mailpit.axllent.org/docs/integration/. Please confirm this does what you expect?
@axllent commented on GitHub (Nov 19, 2023):
I'm closing this issue now as support for optional query parameters in
/view/latest.html?query=...and/view/latest.txt?query=...was released a week ago in the previous version on Mailpit. Please feel free to reopen this issue if you experience any issues.