mirror of
https://github.com/strapi/strapi.git
synced 2025-11-15 01:28:07 +00:00
Avoiding to hard code API request prefix
This commit is contained in:
parent
d65f67e0c5
commit
5ca82b4c83
@ -18,10 +18,10 @@ const createMiddleware = ({ sendEvent }: { sendEvent: Sender }) => {
|
||||
|
||||
const middleware: Core.MiddlewareHandler = async (ctx, next) => {
|
||||
const { url, method } = ctx.request;
|
||||
|
||||
const apiPrefix = strapi.config.get('api.rest.prefix', '/api');
|
||||
if (
|
||||
!url.includes('.') &&
|
||||
url.includes('/api') &&
|
||||
url.includes(apiPrefix) &&
|
||||
['GET', 'PUT', 'POST', 'DELETE'].includes(method)
|
||||
) {
|
||||
if (Date.now() > state.expires) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user