mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 01:02:04 +00:00
Reject related request with include parameter
This commit is contained in:
parent
38f9239ec9
commit
8408538f21
@ -25,7 +25,8 @@ module.exports = {
|
|||||||
const type = this.getType(ctx, actionRoute.controller);
|
const type = this.getType(ctx, actionRoute.controller);
|
||||||
|
|
||||||
// Fetch a relationship that does not exist
|
// Fetch a relationship that does not exist
|
||||||
if (_.isUndefined(type)) {
|
// Reject related request with `include` parameter
|
||||||
|
if (_.isUndefined(type) || (type === 'related' && ctx.params.hasOwnProperty('include'))) {
|
||||||
ctx.response.status = 404;
|
ctx.response.status = 404;
|
||||||
ctx.response.body = '';
|
ctx.response.body = '';
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Fetch and format value
|
// Fetch and format value
|
||||||
const value = this.fetchValue(ctx, object);
|
const value = this.fetchValue(ctx, object);
|
||||||
|
|
||||||
ctx.response.body = this.serialize(ctx, type, object, value);
|
ctx.response.body = this.serialize(ctx, type, object, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user