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

Make it possible to configure the content type of responses returned by generic handlers involving templates #145

Open
ellmetha opened this issue Jan 23, 2024 · 0 comments

Comments

@ellmetha
Copy link
Member

Description

Generic handlers that make use of the Marten::Handlers::Rendering to render templates (like the Marten::Handlers::Template generic handler for example), should make it possible to easily configure the content type associated with the generated response containing the rendered template. By default, this content type should be text/html but it should be possible to override this by calling a dedicated class method.

The envisioned API is as follows:

class MyHandler < Marten::Handlers::Template
  template_name "app/test.xml"
  content_type "application/xml"
end

Special care should be taken to ensure that this class method is added at the Marten::Handlers::Rendering concern level in order to ensure that all generic handlers including it also benefit from this capability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant