kopia lustrzana https://github.com/simonw/datasette
_header_x now defaults to empty string
Prior to this a request to e.g. https://latest.datasette.io/fixtures/magic_parameters which did not include a User-Agent header would trigger a 500 error.json-post
rodzic
2115d7e345
commit
9ac6292614
|
@ -8,7 +8,7 @@ import time
|
|||
def header(key, request):
|
||||
key = key.replace("_", "-").encode("utf-8")
|
||||
headers_dict = dict(request.scope["headers"])
|
||||
return headers_dict[key].decode("utf-8")
|
||||
return headers_dict.get(key, b"").decode("utf-8")
|
||||
|
||||
|
||||
def actor(key, request):
|
||||
|
|
|
@ -186,6 +186,7 @@ def magic_parameters_client():
|
|||
[
|
||||
("_actor_id", "root"),
|
||||
("_header_host", "localhost"),
|
||||
("_header_not_a_thing", ""),
|
||||
("_cookie_foo", "bar"),
|
||||
("_now_epoch", r"^\d+$"),
|
||||
("_now_date_utc", r"^\d{4}-\d{2}-\d{2}$"),
|
||||
|
|
Ładowanie…
Reference in New Issue