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
Is your feature request related to a problem? Please describe.
We'd like to be able to add response headers to things as they're rendered. Specifically, we'd like to be able to add a Surrogate-Key header of a page's author, section, tags, etc when we're rendering the article object. Right now, we can't add to the response based on its content because we don't have access to the response object.
Now model renders and other functions that have access to locals can also do something like locals.res.set("Surrogate-Key", author:${data.author.slug})
Of course, when setting it, one would have to check if it already exists, etc, etc., but this ask is more about getting it on the locals object so it's passed around.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We'd like to be able to add response headers to things as they're rendered. Specifically, we'd like to be able to add a Surrogate-Key header of a page's author, section, tags, etc when we're rendering the article object. Right now, we can't add to the response based on its content because we don't have access to the response object.
Describe the solution you'd like
Assign locals.res to res in amphora somewhere like this: https://github.com/clay/amphora/blob/master/lib/render.js#L119
locals.res = res
Now model renders and other functions that have access to
locals
can also do something likelocals.res.set("Surrogate-Key",
author:${data.author.slug})
Of course, when setting it, one would have to check if it already exists, etc, etc., but this ask is more about getting it on the locals object so it's passed around.
The text was updated successfully, but these errors were encountered: