Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Add query params to PUT and POST #40

Closed
eatyourgreens opened this issue Nov 1, 2017 · 3 comments
Closed

Add query params to PUT and POST #40

eatyourgreens opened this issue Nov 1, 2017 · 3 comments
Assignees

Comments

@eatyourgreens
Copy link
Contributor

Ideally, we'd like to be able to specify query params alongside request payloads, something along the lines of client.type(type).query(paramsObject).create(payloadObject).

This probably requires adding .query() to PUT and POST requests, and updating the client to differentiate between payload data and query params.

@eatyourgreens
Copy link
Contributor Author

Turns out I didn't properly remember how query params are passed to the client. The syntax is client.type(type).get(queryParams).

Maybe the equivalent for create and update should be
resource.update(changeSet).save(queryParams)
client.type(type).create(payload).save(queryParams).

@camallen
Copy link
Contributor

camallen commented Nov 1, 2017

That is a pity as the intention of this code client.type(type).query(paramsObject) reads loud and clear whereas obfuscating behind the get / save params is less intuitive.

Something to revisit if it ever gets rewritten...

@eatyourgreens
Copy link
Contributor Author

.query() reads better to me too, but .type() returns a Resource object so the query params would have to be written to the resource somehow then read on .save()? It might get messy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants