laminas-api-tools / api-tools

Laminas API Tools module for Laminas
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
37 stars 19 forks source link

How to overcome limitations of GET? (X-HTTP-Method-Override?) #18

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

Is there a method in place to overcome GET limitations? For example, browsers/Apache have a maximum character limit on query strings. The ability to send POST but use GET as the overriden method is desired.

Sending a X-HTTP-Method-Override header is the suggested standard that many APIs support. (Google is behind this). I have not found this or any other workaround in Apigility.


Originally posted by @jdukleth at https://github.com/zfcampus/zf-apigility/issues/175

weierophinney commented 4 years ago

+1


Originally posted by @jbh at https://github.com/zfcampus/zf-apigility/issues/175#issuecomment-241523026

weierophinney commented 4 years ago

I made a PR for this feature. I think enabling this listener should be optional, feels not good to connect such a feature by default to the application so I connected the listener depending on a x_http_method_override_enabled key in the config.

Not sure exactly on what is a valid priority value for this listener. I would say as early as possible, currently set to -40 to be triggered before all other zf-campus onRoute listeners, but might earlier might be even better. I added a TODO to check this value...


Originally posted by @Wilt at https://github.com/zfcampus/zf-apigility/issues/175#issuecomment-241801339

weierophinney commented 4 years ago

You can try https://github.com/rstgroup/http-method-override


Originally posted by @snapshotpl at https://github.com/zfcampus/zf-apigility/issues/175#issuecomment-241847046