Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Feature: Zend\Mvc\HttpMethodListener #7240

Conversation

stefanotorresi
Copy link
Contributor

as suggested in #6385, here is the event listener to validate standard HTTP request methods and to make the application return a 405 empty response for unsupported methods.

the listener is ready to be registered via the listeners key in application.config.php with the name HttpMethodListener; however, for the time being it's not registered by default as originally suggested by @weierophinney.

to make that happen, we would have to add a key to Zend\Mvc\Application::$defaultListeners, and I discovered that this would cause some tests to fail because they assert there is precisely one default listener per event, which is a bit odd. Personally, I would update these tests with a different assertion to make them not interfere with future default listeners additions.

Here is a proposal to update the relevant tests ready to merge into this PR.

I will wait for for further instructions on the matter.

stefanotorresi added a commit to stefanotorresi/zf2 that referenced this pull request Feb 21, 2015
as explained in zendframework#7240, previous tests assertions were too specific and
prevented the introduction of additional default event listeners
stefanotorresi added a commit to stefanotorresi/zf2 that referenced this pull request Feb 23, 2015
as explained in zendframework#7240, previous tests assertions were too specific and
prevented the introduction of additional default event listeners
@weierophinney
Copy link
Member

we would have to add a key to Zend\Mvc\Application::$defaultListeners, and I discovered that this would cause some tests to fail because they assert there is precisely one default listener per event, which is a bit odd. Personally, I would update these tests with a different assertion to make them not interfere with future default listeners additions.

This makes sense to me; to be honest, it's an implementation detail at best, so I think we can relax the restrictions.

Please update the PR with the proposed changes, and I'll review again for 2.4!

previous tests assertions were too specific and
prevented the introduction of additional default event listeners
@stefanotorresi
Copy link
Contributor Author

@weierophinney done! 😆

@weierophinney weierophinney merged commit ec5f1a6 into zendframework:develop Feb 25, 2015
weierophinney added a commit that referenced this pull request Feb 25, 2015
…ener

Feature: Zend\Mvc\HttpMethodListener
weierophinney added a commit that referenced this pull request Feb 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants