mozilla-services/contile

Use serde + structs to serialize URL parameters

data-sync-user opened this issue · 0 comments

When crafting URL parameters for HTTP requests (such as when hitting to the adM endpoint), we should prefer constructing them from a formal struct, serialized into a query string via serde.

This would provide more strictness, e.g., preventing bugs where we could duplicate a url parameter by mistake. With a struct, such a bug would be rejected at compile time. The struct also provides a nice place to fully document the parameters, and they can even be rendered to rustdoc output.

Here’s an example of this in old merino code.

┆Issue is synchronized with this Jira Task