zfcampus/zf-rest — pull request #20 by weierophinney (2014-03-18 23:30:13+00:00)
Title: Normalize HTTP method negotiation

In reviewing events within Apigility, I realized the following sequence was the likely expectation:

- Authentication
- HTTP Method Negotiation
- Authorization
- Content Negotiation
- Content Validation

Unfortunately, HTTP Method Negotiation was happening at different times for different service types. For RPC methods, a dedicated listener was registered at the appropriate time. For REST, the negotiation was happening as part of the actual controller dispatch.

This PR normalizes the HTTP Method Negotiation. OPTIONS requests are still handled by the controller. However, a new `OptionsListener` is now registered at the same priority as the RPC `OptionsListener`, and returns a 405 response for invalid requests. It is provided the `zf-rest` configuration, and distinguishes between entity and collection requests when determining which set of HTTP methods to compare against.