In the _request method of the net\http\Service class there is an array of methods where request data must be sent in the body instead of query string. However, the PATCH method is not included.
Should we refactor the class to allow the user to specify how data should be sent (but having sane defaults for GET, POST, PUT...)? This might be an edge case, but it would be useful for setups where non-standard http methods are used.
A quick-and-dirty hack would be to add PATCH to that list...
What do you think?
Good catch. Since Service is a pretty easily user-extendable class, and because there aren't that many instances where you'd need to change up how data is encoded based on the request method, I think adding 'PATCH' to the array is a perfectly acceptable fix.
You can submit a pull request, or I'll edit it when I have a second. Thanks!
By the way, should we add a patch() method to the Service class also? I know the __call method handles this case, but since there is 1:1 mapping of all other standard http methods... I guess it would be useful only for code completion in some IDEs...
Data for PATCH requests in net\http\Service should be encoded in the …
…request body. Fixes #647.
Sure, let's do a method. We can always refactor to a call implementation or something later on.