contile icon indicating copy to clipboard operation
contile copied to clipboard

Use serde + structs to serialize URL parameters

Open data-sync-user opened this issue 1 year ago • 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

data-sync-user avatar Aug 18 '22 21:08 data-sync-user