Open klh opened 5 years ago
i realize it's sorta by design, but when using something like:
// method and url
getMethodUrl: 'GET users/:id/:some/:thing',
readability increases when doing
user.getMethodUrl({"id":2, "some": 0, "thing":0})
instead of
user.getMethodUrl("2","0","0")
Hey, I see what you're saying and I think it's something I've considered before.
You're basically saying, for a GET request (or any request) when a param has been used in the URL, exclude it from the payload?
There's another post about this kind of thing as well. I wonder if should enable some kind of configuration. Possibly globally and per actions set, i.e.:
// global config
ApiCore.configure({ ... })
const actions = {
_config: { ... }, // local config
foo: 'foo/:id'
}
Or maybe a syntax:
foo: 'foo/:id!'
What do you think?
I Think its a great idea, I can understand that there might be outliers and festure triggers on endpoints where you need both, but an endpoint toggle would be great.
Also checkout how apisauce does error normalization and api simplification - could be a good way to enhance a few things.
Also your plugins.upperCase example doesn’t really work as described (plugins cannot be extended as is)
On 3 Apr 2019, at 11.36, Dave Stewart notifications@github.com wrote:
Hey, I see what you're saying and I think it's something I've considered before.
You're basically saying, for a GET request (or any request) when a param has been used in the URL, exclude it from the payload?
There's another post about this kind of thing as well. I wonder if should enable some kind of configuration. Possibly globally and per actions set, i.e.:
ApiCore.configure({ ... })
const actions = { _config: { ... }, // rules on how these things could be handled foo: 'foo/:id'' } What do you think?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Jest test:
results in a get request to the endpoint like this:
where it in reality should be: