Files
typeshed/stdlib
Maarten ter Huurne 9bba8a4b83 Correct annotation of headers parameter of HTTP event handlers (#5854)
* Use HTTPMessage for the headers parameter of HTTP event handlers

While the documentation of `BaseHandler.http_error_default()` describes
the `hdrs` (`headers` in most other handlers) as "a mapping object with
the headers of the error", the implementation that is located in
`URLopener._open_generic_http()` will pass `response.msg` instead,
which is of type `http.client.HTTPMessage`.

* Use Message for the headers parameter of HTTPError

When the standard library constructs `HTTPError`, it will
pass an `http.client.HTTPMessage`, which is a subclass of
`email.message.Message`. Picking the superclass for the
annotations gives users the flexibility to for example
the result of the `email.message_from_X()` functions.

The only thing unique to `HTTPMessage` is the undocumented
`getallmatchingheaders()` method, which is only called by
`http.server.CGIHTTPRequestHandler.run_cgi()`. That class
gets its headers from `http.client.parse_headers()` and not
from `HTTPError`, so I think it's safe to use `Message`
as the annotation.
2021-08-06 10:55:49 +02:00
..
2021-04-29 07:02:52 -07:00
2021-05-02 16:24:34 -07:00
2021-05-17 20:45:48 +02:00
2021-05-06 18:57:33 +03:00
2021-05-01 20:58:30 -07:00
2021-06-24 16:56:09 +03:00
2021-05-30 20:17:33 +02:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-05-05 17:23:43 +03:00
2021-05-17 20:45:48 +02:00
2021-01-27 12:00:39 +00:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-05-13 18:20:55 -07:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-04-14 19:14:07 -07:00
2021-05-05 17:23:43 +03:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-07-09 12:54:22 +03:00
2021-04-30 20:05:06 +02:00
2021-05-17 20:45:48 +02:00
2021-07-30 06:50:27 -07:00
2021-03-23 20:56:47 -07:00
2021-05-17 20:45:48 +02:00
2021-05-13 18:20:55 -07:00
2021-08-04 15:39:46 -07:00
2021-05-17 20:45:48 +02:00
2021-05-17 20:45:48 +02:00
2021-04-17 07:03:28 -07:00