Middleware feature #55
Open
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.
This addresses #52
I've added traits
ClientandRequestBuilderthat abstract over the specific implementation of a client and request builder - implemented by the correspondingreqwestandreqwest_middlewaretypes.We already has
RequestBuilderExt, but it serves a different purpose. I renamed it toUpgrade, since that's the functionality it actually provides. I did think about this renaming in the past anyway, so this was a good time to do it.The
Upgradeextension trait will be implemented automatically for anything that is aRequestBuilder. It returns anUpgraded<R> where R: RequestBuilderthat then is generic, but has all the information to perform the websocket upgrade.All the
middlewarefeature then has to do, is to implement theClientandClientBuildertraits forreqwest_middleware::ClientWithMiddlewareandreqwest_middleware::RequestBuilderrespectively.Because of the new traits and renamings, this will require a minor version bump.
There's one test for the
middlewarefeature right now, but it doesn't work on wasm. Themiddlewarefeature does compile for wasm, but we should make sure it's actually usable.