From 7a7a0d93b059ad3cb46392e40f195016ae335468 Mon Sep 17 00:00:00 2001 From: gus <0x67757300@gmail.com> Date: Fri, 15 Dec 2023 10:49:54 -0300 Subject: [PATCH] don't overwrite content-length --- pyproject.toml | 2 +- uhttp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 27c5368..3e816ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "uHTTP" -version = "1.3.0" +version = "1.3.1" description = "Pythonic web development" authors = ["gus <0x67757300@gmail.com>"] license = "MIT" diff --git a/uhttp.py b/uhttp.py index f5b5607..337d421 100644 --- a/uhttp.py +++ b/uhttp.py @@ -375,7 +375,7 @@ async def __call__(self, scope, receive, send): except Response as early_response: response = early_response - response.headers._update({'content-length': [len(response.body)]}) + response.headers.setdefault('content-length', len(response.body)) response.headers._update({ 'set-cookie': [ header.split(': ', maxsplit=1)[1]