Skip to main content Link Menu Expand (external link) Document Search Copy Copied

To set a custom header to the response.headers. This will overwrite the existing header (if any).

Example:

# ...

@app.route('/hello')
async def hello_world(request, response):
    response.set_header('X-Powered-By', 'bar')

    return 'Hello, World!'

# ...