Flask/Werkzeug how to attach HTTP content-length header to file download

后端 未结 3 1449
星月不相逢
星月不相逢 2020-12-14 18:49

I am using Flask (based on Werkzeug) which uses Python.

The user can download a file, I\'m using the send_from_directory-function.

However when actually down

3条回答
  •  [愿得一人]
    2020-12-14 19:26

    I needed this also, but for every requests, so here's what I did (based on the doc) :

    @app.after_request
    def after_request(response):
        response.headers.add('Access-Control-Allow-Origin', '*')
        return response
    

提交回复
热议问题