File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,14 @@ def test_one_input(data):
14
14
reader .feed_data (data )
15
15
reader .feed_eof ()
16
16
17
+ parser = Request .parse (
18
+ reader .read_line ,
19
+ )
20
+
17
21
try :
18
- Request . parse (
19
- reader . read_line ,
20
- )
22
+ next ( parser )
23
+ except StopIteration :
24
+ pass # request is available in exc.value
21
25
except (
22
26
EOFError , # connection is closed without a full HTTP request
23
27
SecurityError , # request exceeds a security limit
Original file line number Diff line number Diff line change @@ -14,17 +14,20 @@ def test_one_input(data):
14
14
reader .feed_data (data )
15
15
reader .feed_eof ()
16
16
17
+ parser = Response .parse (
18
+ reader .read_line ,
19
+ reader .read_exact ,
20
+ reader .read_to_eof ,
21
+ )
17
22
try :
18
- Response .parse (
19
- reader .read_line ,
20
- reader .read_exact ,
21
- reader .read_to_eof ,
22
- )
23
+ next (parser )
24
+ except StopIteration :
25
+ pass # response is available in exc.value
23
26
except (
24
- EOFError , # connection is closed without a full HTTP response.
25
- SecurityError , # response exceeds a security limit.
26
- LookupError , # response isn't well formatted.
27
- ValueError , # response isn't well formatted.
27
+ EOFError , # connection is closed without a full HTTP response
28
+ SecurityError , # response exceeds a security limit
29
+ LookupError , # response isn't well formatted
30
+ ValueError , # response isn't well formatted
28
31
):
29
32
pass
30
33
You can’t perform that action at this time.
0 commit comments