Hi, 

This question is more of a curious one as I explore different possible 
solutions for a problem.

What is the recommended way of adding an X-Myapp-Didum header to *every* 
response returned from the server? It looks like there are different ways 
to achieve that:

   - Change the Response factory 
   
<https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/hooks.html#changing-the-response-factory>:
 
   inherit from the Pyramid Response class and add the header in __init__;
   - Use a Response callback 
   
<https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/hooks.html#using-response-callbacks>
 
   which adds the header whenever a response is returned from a view function;
   - A Finished callback 
   
<https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/hooks.html#using-finished-callbacks>,
 
   like the Response callback, can add the header to the request.response 
   object.

It looks like the Response factory is the favorable way to go, considering 
that both callbacks seem to work only on a per-request basis? Or what other 
ways exist to achieve this?

Thanks!
Jens

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/2f333583-13ff-4587-a11d-b81e47948109%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to