def __call__(self, environ, start_response):

    def custom_start_response(status, headers, exc_info=None):
        headers.append(('Set-Cookie', 'name=value'))
return start_response(status, headers, exc_info)
return self.app(environ, custom_start_response)
How to add http headers in WSGI middleware?