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

make TrailingSlash enum accessible #1673

Merged
merged 5 commits into from Sep 12, 2020

Conversation

Lesiuk
Copy link
Contributor

@Lesiuk Lesiuk commented Sep 12, 2020

PR Type

Bug Fix

PR Checklist

  • 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

Wanted to try middleware::NormalizePath::new(TrailingSlash::Trim) introduced in 3.0.0 but I noticed that TrailingSlash enum is inside private package and It's not currently possible.

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2020

Codecov Report

Merging #1673 into master will increase coverage by 0.14%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1673      +/-   ##
==========================================
+ Coverage   53.29%   53.43%   +0.14%     
==========================================
  Files         123      121       -2     
  Lines       11856    11853       -3     
==========================================
+ Hits         6319     6334      +15     
+ Misses       5537     5519      -18     
Impacted Files Coverage Δ
tests/test_server.rs 100.00% <100.00%> (ø)
actix-http/src/header/common/accept.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/accept_language.rs
actix-http/src/header/common/allow.rs
actix-http/src/header/common/content_language.rs
actix-http/src/header/common/if_none_match.rs
...ctix-http/src/header/common/if_unmodified_since.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/if_match.rs 0.00% <0.00%> (ø)
actix-http/src/h1/decoder.rs 63.23% <0.00%> (+1.37%) ⬆️
actix-http/src/header/common/mod.rs 10.00% <0.00%> (+2.30%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64a2c13...33ca882. Read the comment docs.

@robjtede
Copy link
Member

Needs a cargo fmt.

Can we add a test to tests/test_server.rs something like:

#[actix_rt::test]
async fn test_normalize() {
    let srv = test::start_with(test::config().h1(), || {
        App::new()
            .wrap(Compress::new(NormalizePath::new(TrailingSlash::Trim)))
            .service(web::resource("/one").route(web::to(|| HttpResponse::Ok().finish())))
    });

    let mut response = srv
        .get("/one/")
        .send()
        .await
        .unwrap();
    assert!(response.status().is_success());
}

@robjtede robjtede changed the title actix_web::middleware::normalize is private so we cannot use actix_web::middleware::normalize::TrailingSlash and middleware::NormalizePath::new make TrailingSlash enum accessible Sep 12, 2020
Damian Lesiuk added 2 commits September 12, 2020 16:51
@robjtede robjtede linked an issue Sep 12, 2020 that may be closed by this pull request
@robjtede
Copy link
Member

Just a changelog entry and we can get this released.

@robjtede robjtede merged commit a4546f0 into actix:master Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TrailingSlash isn't exported
3 participants