Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple returned content types from one renderer #1275

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bradykieffer
Copy link

I love the project - a request we commonly see from users is the ability to obtain our data in separate formats. I've seen my fair share of endpoints that are essentially identical, where one spits out JSON and another spits out CSV. Maintaining these forked views is pretty annoying, so I figured enabling APIs to render responses based on the Accept header would be a cool feature 😄

I picked Dynamic in about 30 seconds, so very open to renaming this. But would love to get this type of functionality in.

@bradykieffer bradykieffer force-pushed the brady/dynamic-media-type branch 2 times, most recently from 27e0f82 to 6d7d0a4 Compare September 10, 2024 19:31
@bradykieffer
Copy link
Author

bradykieffer commented Sep 10, 2024

The missing pagination coverage is in: #1276 which I don't want to blindly copy-paste. However, my patch is covered fully now.

Would be great to know if this is a feasible change, or what else would be needed.

@bradykieffer bradykieffer force-pushed the brady/dynamic-media-type branch 2 times, most recently from bdf01e2 to 799e501 Compare September 19, 2024 15:31
Switch these off of the accept header within a request. This allows
users to dynamically render a response based on the clients passed
value, with a fallback to whatever media type is specified by default.
The list is implicitly ordered by priority. I don't love that it's a
nested loop, however, I think that it should be fine, for relatively
few content types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant