请求期间丢失内容长度标头(Django)

时间:2019-09-23 18:01:58

标签: django http nginx header uwsgi

使用

    clen = os.path.getsize(the_file)
    response['content-disposition'] = "attachment; filename=%s" % filename
    response['content-length'] = clen
    return response

导致响应标头仅包含内容配置,而不包含内容长度 如果我添加一个无意义的标题,如

    response['bla'] = 'some non-sense'

它完美地出现在响应中。是否有其他地方覆盖头文件或其他内容。我在uwsgi中使用了nginx。

1 个答案:

答案 0 :(得分:0)

使用application / octet-stream作为Content-Type时,会在标头中发送

Content-Length