Closed eduardog closed 5 years ago
Thanks for your feedback and PR, but I don't see where the problem is. You should be able to call such a request like this:
rel.call({ method: "API" }, { method: "POST" })
# looks better on multiple lines IMO
body = {
method: "API",
a: "b",
}
rel.call(body, method: "POST")
Specifying the method to #call without a body is ambiguous, so that method's documentation has been updated to reflect actual behavior.
A user could theoretically set up a Relation with a default method of POST for an endpoint that expects a method value in a body being serialized from a hash. I'm not sure there's a way to differentiate that case from someone trying to specify a body-less method type in the options hash that doesn't violate the principle of least surprise in at least some cases.