Closed stevenrombauts closed 6 years ago
Thank you very much for this, I really appreciate it.
I have opened a PR for myself, #10 which contains your work to get this ready to be merged into master.
I have made a small number of changes, such as making the default behaviour the same as it is currently. That is to say by default an endpoint executes regardless of method rather than strictly on GET
as a. the change would be breaking and b. I think it's a better default behaviour.
I have also prefixed the constants with METHOD_
and removed the strtoupper on $method
because methods may technically be in any casing, it just so happens that all registered methods are upper case - and I'd hate for that to interfere with someone's testing.
I have a little more testing and cleanup to do, but I expect to have this merged in the next day or two.
Again, I just want to thank you for the work you put into this and for adding a test. That honestly goes a long way in expediting merges.
Thanks for your reply, and for including the changes into your project! I was blindly assuming the default behavior would be GET
and didn't consider it should be replying to all methods, so that change makes total sense.
If you need some more changes or testing, I'm happy to help!
Purpose
This PR adds support for multiple HTTP methods (and solves the existing issue #3). It does this by adding the HTTP method as the file extensions for the response "alias path". By default it now only supports
GET
requests.Example
I also added a new
methods.php
example in theexamples
directory.Tests
A new test is added to
MockWebServer_IntegrationTest
calledtestHttpMethods
.Misc
If there are any changes you'd like to see to this PR, just let me know. Thanks for an excellent tool!