如何在 Apigility 中禁用 Content-type 检查?
How to disable Content-type check in Apigility?
在 Apigility 中有一个 ContentTypeFilterListener
侦听器检查 content-type
headers。我不需要它并且经常导致错误消息:
Invalid content-type specified.
有什么方法可以完全禁用此功能?
ContentTypeFilterListener 使用 attachAggregate
方法附加到 EventManager
here in the Module.php on line 46:
$em->attachAggregate($services->get('ZF\ContentNegotiation\ContentTypeFilterListener'));
这意味着您还可以使用 detachAggregate
:
再次分离它
$em->detachAggregate($services->get('ZF\ContentNegotiation\ContentTypeFilterListener'));
附加后您应该可以执行此操作。
在 Apigility 中有一个 ContentTypeFilterListener
侦听器检查 content-type
headers。我不需要它并且经常导致错误消息:
Invalid content-type specified.
有什么方法可以完全禁用此功能?
ContentTypeFilterListener 使用 attachAggregate
方法附加到 EventManager
here in the Module.php on line 46:
$em->attachAggregate($services->get('ZF\ContentNegotiation\ContentTypeFilterListener'));
这意味着您还可以使用 detachAggregate
:
$em->detachAggregate($services->get('ZF\ContentNegotiation\ContentTypeFilterListener'));
附加后您应该可以执行此操作。