Skip to content

Loading…

Data for PATCH requests in net\http\Service should be encoded in the request body #647

Closed
ppadron opened this Issue · 3 comments

2 participants

@ppadron

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?

@nateabele
Union of RAD member

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!

@ppadron

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...

@nateabele nateabele closed this in 2576ec8
@nateabele
Union of RAD member

Sure, let's do a method. We can always refactor to a call implementation or something later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.