mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
fix: revert #10801
This commit is contained in:
@@ -15,7 +15,7 @@ scalar Date
|
||||
|
||||
type Query {
|
||||
recipe(id: String!): Recipe!
|
||||
recipes(skip: Int = 0, take: Int = 25): [Recipe!]!
|
||||
recipes(skip: Int! = 0, take: Int! = 25): [Recipe!]!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
||||
@@ -316,10 +316,11 @@ export class MiddlewareModule<
|
||||
) {
|
||||
const prefix = this.config.getGlobalPrefix();
|
||||
const excludedRoutes = this.config.getGlobalPrefixOptions().exclude;
|
||||
|
||||
const isAWildcard = ['*', '/*', '(.*)', '/(.*)'].includes(path);
|
||||
if (
|
||||
Array.isArray(excludedRoutes) &&
|
||||
isRouteExcluded(excludedRoutes, path, method)
|
||||
(Array.isArray(excludedRoutes) &&
|
||||
isRouteExcluded(excludedRoutes, path, method)) ||
|
||||
isAWildcard
|
||||
) {
|
||||
path = addLeadingSlash(path);
|
||||
} else {
|
||||
@@ -343,6 +344,7 @@ export class MiddlewareModule<
|
||||
const isMethodAll = isRequestMethodAll(method);
|
||||
const requestMethod = RequestMethod[method];
|
||||
const router = await applicationRef.createMiddlewareFactory(method);
|
||||
|
||||
const middlewareFunction = isMethodAll
|
||||
? proxy
|
||||
: <TRequest, TResponse>(
|
||||
@@ -356,11 +358,6 @@ export class MiddlewareModule<
|
||||
return next();
|
||||
};
|
||||
|
||||
const isAWildcard = ['*', '/*', '(.*)', '/(.*)'].includes(path);
|
||||
if (isAWildcard && Array.isArray(excludedRoutes)) {
|
||||
excludedRoutes.forEach(route => router(route.path, middlewareFunction));
|
||||
}
|
||||
|
||||
router(path, middlewareFunction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user