mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 16:05:53 +03:00
[PR #528] [MERGED] feat: Add support for reqwest-middleware #516
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#516
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?
📋 Pull Request Information
Original PR: https://github.com/ramsayleung/rspotify/pull/528
Author: @lazulit3
Created: 6/11/2025
Status: ✅ Merged
Merged: 6/17/2025
Merged by: @ramsayleung
Base:
master← Head:master📝 Commits (6)
2eace79feat: Add support forreqwest-middleware0ca08d2style(rspotify-http): fix fmt lint, sort re-exports321edfffix(rspotify-http): disable lint based on feat flagfc6c370test(rspotify-http): add test for reqwest-middlewared83ebc5style(rspotify-http): remove accidental diff (space)6f19ab2refactor(rspotify-http): clarify feat-gated imports📊 Changes
7 files changed (+213 additions, -18 deletions)
View changed files
📝
Cargo.toml(+3 -0)📝
rspotify-http/Cargo.toml(+6 -0)📝
rspotify-http/src/lib.rs(+3 -0)📝
rspotify-http/src/reqwest.rs(+147 -18)📝
src/auth_code.rs(+18 -0)📝
src/auth_code_pkce.rs(+18 -0)📝
src/client_creds.rs(+18 -0)📄 Description
Description
Adds a
reqwest-middlewarefeature flag torspotify-httpandrspotify. When enabled, this will:rspotify-httpthat would allow the library to build a client with middlewarewith_middlewareandwith_middleware_arcfor adding middleware to each rspotify clientMotivation and Context
I am interested in using http-cache-reqwest to cache my API responses using ETags provided in Spotify API responses. Adding support for middleware would allow users to construct their
rspotifyclients with caching or other middlewares.Dependencies
This doesn't depend on other changes.
Type of change
Please delete options that are not relevant.
How has this been tested?
A test has been added to the PR.
I have not tested this beyond using it in a personal project.I have used this successfully in a personal project for caching. Here's an example of usage:
I've verified that my middleware (caching) works by inspecting my API responses using a local proxy (Proxyman). This verifies that the middleware is used.
Is this change properly documented?
No, sorry. Would love help! (Non-maintainers are welcome to PR against my branch.)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.