calm icon indicating copy to clipboard operation
calm copied to clipboard

Add mechanism for setting default headers

Open hippysurfer opened this issue 7 years ago • 1 comments

Hi Firstly, thank you for releasing Calm - I am having fun working with it.

I found that I needed to set a default header on all requests to enable CORS. I ended up using the following hack:

import calm.core def set_default_headers(self, args, **kwargs): self.set_header("Access-Control-Allow-Origin", "")

calm.core.MainHandler.set_default_headers = set_default_headers

May be this is not the correct way to achieve this, but it would be great if there was a documented way to add a default header with out having to use custom request handler classes.

Many thanks

Richard

hippysurfer avatar Nov 15 '17 10:11 hippysurfer

Hi Richard,

Thanks for using Calm and for the feedback.

Sorry to say this, but at the moment I am focused on another project and spend most of my free time on it. However, if you could shoot a Pull Request implementing the feature you described, I would be more than happy to review it and release as soon as merged.

Please let me know if that works for you.

bagrat avatar Nov 16 '17 16:11 bagrat