You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Htmxor should include a generic way for developers to declaratively influence any headers during when returning a response to a request, not just the htmx specific headers that are exposed via the HtmxContext.Response, aka. HtmxResponse object.
There are two scenarios in play:
Headers that are dynamically set based on request or dynamic content:
Right now, developers can [Inject] private HttpContext Ctx in a component and set response headers through that. For convenience, this could also be enabled through a generic Headers property on the HtmxResponse type, which would just point to the HtmlContext.Response.Headers dictionary.
Headers that are statically determined at compile time:
These are good candidates for a declarative approach. My idea is for Htmxor to include a IControlResponseHeaders interface, that any attribute can implement. Then, developers can implement custom attributes that implement this interface and use these attributes in their components declaratively.
Htmxor should include a generic way for developers to declaratively influence any headers during when returning a response to a request, not just the htmx specific headers that are exposed via the
HtmxContext.Response
, aka.HtmxResponse
object.There are two scenarios in play:
Headers that are dynamically set based on request or dynamic content:
Right now, developers can
[Inject] private HttpContext Ctx
in a component and set response headers through that. For convenience, this could also be enabled through a genericHeaders
property on theHtmxResponse
type, which would just point to theHtmlContext.Response.Headers
dictionary.Headers that are statically determined at compile time:
These are good candidates for a declarative approach. My idea is for Htmxor to include a
IControlResponseHeaders
interface, that any attribute can implement. Then, developers can implement custom attributes that implement this interface and use these attributes in their components declaratively.Here is the interface definition:
And an example attribute:
This can then be used like this:
Inspired by: https://mastodon.social/@khalidabuhakmeh/112339241113769565
The text was updated successfully, but these errors were encountered: