Skip to content

Commit

Permalink
Loading a plugin should always verify its presence
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebodin committed Aug 24, 2022
1 parent a52b053 commit 9ad6931
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/strapi/lib/middlewares/body.js
Expand Up @@ -27,12 +27,15 @@ function getFiles(ctx) {
module.exports = (config, { strapi }) => {
const bodyConfig = defaultsDeep(defaults, config);

const { config: gqlConfig } = strapi.plugin('graphql');
const gqlEndpoint = gqlConfig('endpoint');
let gqlEndpoint;
if (strapi.plugin('graphql')) {
const { config: gqlConfig } = strapi.plugin('graphql');
gqlEndpoint = gqlConfig('endpoint');
}

return async (ctx, next) => {
// TODO: find a better way later
if (ctx.url === gqlEndpoint) {
if (gqlEndpoint && ctx.url === gqlEndpoint) {
await next();
} else {
try {
Expand Down

0 comments on commit 9ad6931

Please sign in to comment.