Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Compat middleware #1865

Merged
merged 7 commits into from
Jan 5, 2021
Merged

add Compat middleware #1865

merged 7 commits into from
Jan 5, 2021

Conversation

fakeshadow
Copy link
Contributor

@fakeshadow fakeshadow commented Jan 1, 2021

PR Type

Feature

PR Checklist

Check your PR fulfills the following:

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

Added Compat middleware. It would transform any middleware and output Result<ServiceResponse<Body>, Error>(as long as the transformed output can be convert to it).

This enables Compress and Logger middleware being used in Condition middleware and Resource/Scope service.

The name of the middleware could be named better and ideas are welcome.

Closes #1448

src/middleware/scoped.rs Outdated Show resolved Hide resolved
src/middleware/scoped.rs Outdated Show resolved Hide resolved
src/middleware/scoped.rs Outdated Show resolved Hide resolved
src/middleware/scoped.rs Outdated Show resolved Hide resolved
type Future = ScopedFuture<S::Future>;

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx).map_err(From::from)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: should this be the definition of the new forward_ready! macro

@fakeshadow fakeshadow added A-web project: actix-web B-semver-minor labels Jan 4, 2021
@robjtede robjtede changed the title add scoped middleware add Compat middleware Jan 4, 2021
@robjtede robjtede merged commit 4f5971d into master Jan 5, 2021
@robjtede robjtede deleted the feat/scoped-middleware branch January 5, 2021 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web project: actix-web B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use Condition with Logger middleware
2 participants