SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

Allow passing Mongo REST AP GET /coll parameters such as filter, sort, keys, hint via headers #490

Open ujibang opened 9 months ago

ujibang commented 9 months ago

Brief overview

the Mongo REST API allows querying collections via GET /coll?filter={...}&sort={...}&keys&hint={...} specifying query parameters using query parameters.

Allow to pass the same parameters via headers as well.

Rationale

This feature increases the security (because headers are encrypted) and simplify handling special chars (chars that need to url encoded).

Example

GET /coll/filter={"_id": {"$regex": { "^.*\<variable>" }}

If <variable> = " or <variable> = \ or <variable> = + the request fails. The variable must be encoded or quoted. This makes complex building dynamically queries.

Detailed documentation

TBD

ujibang commented 5 months ago

we do have an example that does exactly this https://github.com/SoftInstigate/restheart/blob/master/examples/x-headers-to-qparams/README.md