File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -600,13 +600,6 @@ def __init__(
600600 real_headers [hdrs .CONTENT_TYPE ] = content_type + "; charset=" + charset
601601 body = text .encode (charset )
602602 text = None
603- elif hdrs .CONTENT_TYPE in real_headers :
604- if content_type is not None or charset is not None :
605- raise ValueError (
606- "passing both Content-Type header and "
607- "content_type or charset params "
608- "is forbidden"
609- )
610603 elif content_type is not None :
611604 if charset is not None :
612605 content_type += "; charset=" + charset
Original file line number Diff line number Diff line change @@ -1152,16 +1152,19 @@ def test_ctor_both_charset_param_and_header_with_text() -> None:
11521152 )
11531153
11541154
1155- def test_ctor_both_content_type_param_and_header () -> None :
1156- with pytest .raises (ValueError ):
1157- web .Response (
1158- headers = {"Content-Type" : "application/json" }, content_type = "text/html"
1159- )
1155+ def test_ctor_content_type_param_and_header_without_text () -> None :
1156+ resp = web .Response (
1157+ headers = {"Content-Type" : "application/json" }, content_type = "text/html"
1158+ )
11601159
1160+ assert resp .content_type == "text/html"
11611161
1162- def test_ctor_both_charset_param_and_header () -> None :
1163- with pytest .raises (ValueError ):
1164- web .Response (headers = {"Content-Type" : "application/json" }, charset = "koi8-r" )
1162+
1163+ def test_ctor_charset_param_and_header_without_text () -> None :
1164+ resp = web .Response (headers = {"Content-Type" : "application/json" }, charset = "koi8-r" )
1165+
1166+ assert resp .content_type == "application/json"
1167+ assert resp .charset is None
11651168
11661169
11671170async def test_assign_nonbyteish_body () -> None :
You can’t perform that action at this time.
0 commit comments