4 ms·
I’m not quite sure I grok the use case, can you give a more precise example? Either way, if you’re interested in the approach I *very welcome* issues, PRs and c
by keithwhor 3y ago
I’m not quite sure I grok the use case, can you give a more precise example? Either way, if you’re interested in the approach I *very welcome* issues, PRs and contributors. I think it would be pretty straightforward to create tests for whatever you’re looking for.
- mstade 3y agoHere's a simple use case: human friendly and machine friendly representations at the same path. For example, let's say I have an api at `/weather` which when requested with the header `accept: application/json` returns something like: { "temperature": 25, "unit": "c" } Now if I open that same path in a browser, I get an html page displaying the day's temperature in a nicely formatted way for humans to read. Or another case, I want to version an API, such that I can provide different representations based on the version requested. So I look for `accept-version` and if it's `v1` for example I get the `v1` version. GitHub does this, as a real world example: https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022-11-28 https://docs.github.com/en/rest/overview/api-versions?apiVer...
- keithwhor 3y agoEntirely possible! I mean right now we restrict endpoint definitions to HTTP methods but in theory you could define unique endpoints for any combination of parameters. What I would want to find is the most effective / used combinations as opposed to unlimited flexibility.