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

Feature/8844 api version in route info #10484

Merged

Conversation

thiagomini
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Routes middleware aren't applied to versioned routes when using uri-versioning-type.

Issue Number: #8844

What is the new behavior?

middlewares can be applied to versioned routes with the following API:

class TestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply((req, res, next) => res.send(VERSIONED_VALUE))
      .forRoutes({
        path: '/versioned',
        version: '1',
        method: RequestMethod.ALL,
      });
  }
}

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

ensure routes mapper returns route's version when defined
ensure routes mapper returns route's version when defined
ensure middleware builder gets route version
ensure middleware module considers path-versioning when applying middlewares
method: defaultRequestMethod,
},
];
return this.getRouteInfoFromPath(route);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I extracted many logic branches here to private methods to improve the public method's readability.

@coveralls
Copy link

coveralls commented Oct 31, 2022

Pull Request Test Coverage Report for Build c8bde737-3fac-4677-8237-7ef34ba51ed0

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 93.797%

Totals Coverage Status
Change from base Build 429b8255-55d8-42a4-b8d8-82bc75f526f4: 0.009%
Covered Lines: 6124
Relevant Lines: 6529

💛 - Coveralls

wrap test case for uri versioning context to facilitate the addition of tests for other versioning types
fix middlewares for versioned routes using header as versioning type
fix middlewares for versioned routes using media type as versioning type
refactor middleware tests to explicitly define versioning options
add middleware versionig support for uri versioning with an alternative prefix
add missing parameter to middleware module
@kamilmysliwiec
Copy link
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants