diff --git a/CHANGES.rst b/CHANGES.rst index 3bef822885..f85c5d9572 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -61,6 +61,9 @@ CHANGES - Remove aiohttp.websocket module (BACKWARD IMCOMPATIBLE) Please use high-level client and server approaches +- Link header for 451 status code is mandatory + + 0.22.5 (08-02-2016) ------------------- diff --git a/aiohttp/web_exceptions.py b/aiohttp/web_exceptions.py index 4b226dbdf0..b886697a5d 100644 --- a/aiohttp/web_exceptions.py +++ b/aiohttp/web_exceptions.py @@ -289,13 +289,12 @@ class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): class HTTPUnavailableForLegalReasons(HTTPClientError): status_code = 451 - def __init__(self, link=None, *, headers=None, reason=None, + def __init__(self, link, *, headers=None, reason=None, body=None, text=None, content_type=None): super().__init__(headers=headers, reason=reason, body=body, text=text, content_type=content_type) - if link: - self.headers['Link'] = '<%s>; rel="blocked-by"' % link - self.link = link + self.headers['Link'] = '<%s>; rel="blocked-by"' % link + self.link = link ############################################################