status-error.py (553B)
1 def main(request, response): 2 status = (request.GET.first(b"status", b"404"), b"HAHAHAHA") 3 headers = [(b"Content-Type", b"text/event-stream")] 4 5 # According to RFC7231, HTTP responses bearing status code 204 or 205 must 6 # not specify a body. The expected browser behavior for this condition is not 7 # currently defined--see the following for further discussion: 8 # 9 # https://github.com/web-platform-tests/wpt/pull/5227 10 if status[0] in [b"204", b"205"]: 11 body = b"" 12 else: 13 body = b"data: data\n\n" 14 15 return status, headers, body