如何在Apigility中禁用内容类型检查


How to disable Content-type check in Apigility?

有一个ContentTypeFilterListener侦听器在Apigility中检查content-type头。我不需要它,并且经常导致错误消息:

指定的内容类型无效。

有什么办法可以完全禁用这个功能吗?

ContentTypeFilterListener使用attachAggregate方法连接到Module.php第46行的EventManager

$em->attachAggregate($services->get('ZF'ContentNegotiation'ContentTypeFilterListener'));

这意味着您也可以使用detachAggregate:再次分离它

$em->detachAggregate($services->get('ZF'ContentNegotiation'ContentTypeFilterListener'));

您应该能够在附加后执行此操作。