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

时间:2015-10-30 10:25:03

标签: php zend-framework2 content-type apigility

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

  

指定的内容类型无效。

有没有办法完全禁用此功能?

1 个答案:

答案 0 :(得分:1)

ContentTypeFilterListener使用EventManager方法附加到attachAggregate here in the Module.php on line 46

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

这意味着您还可以使用detachAggregate

再次分离它
$em->detachAggregate($services->get('ZF\ContentNegotiation\ContentTypeFilterListener'));

连接后你应该可以这样做。