[feature] idempotency header middleware #3186
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a piece of middleware supporting the idempotency key. Though probably worth you looking through this PR first before we do anything with it @VyrCossont as you have more experience working with this client-side. I specifically wanted to avoid caching anything more than the status code for each response, as it would either require buffering and caching of response bodies which could end up quite memory intensive, or it will require a unique solution for every single endpoint which i'm also really not a fan of. Is responding with the previous status code + a "this already happened" http response body good enough for clients to work with? 🤔
closes #2723
Checklist
go fmt ./...
andgolangci-lint run
.