File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
CHANGES
2
2
=======
3
3
4
+ 0.13.1 (Unreleased)
5
+ --------------------
6
+
7
+ - Add `aiohttp.web.StreamResponse.started` property #213
8
+
9
+
4
10
0.13.0 (12-29-2014)
5
11
-------------------
6
12
Original file line number Diff line number Diff line change @@ -409,6 +409,10 @@ def _copy_cookies(self):
409
409
value = cookie .output (header = '' )[1 :]
410
410
self .headers .add ('Set-Cookie' , value )
411
411
412
+ @property
413
+ def started (self ):
414
+ return self ._resp_impl is not None
415
+
412
416
@property
413
417
def status (self ):
414
418
return self ._status
Original file line number Diff line number Diff line change @@ -474,6 +474,11 @@ StreamResponse
474
474
parameter. Otherwise pass :class: `str ` with
475
475
arbitrary *status * explanation..
476
476
477
+ .. attribute :: started
478
+
479
+ Read-only :class: `bool ` property, ``True `` if :meth: `start ` has
480
+ been called, ``False `` otherwise.
481
+
477
482
.. attribute :: status
478
483
479
484
Read-only property for *HTTP response status code *, :class: `int `.
Original file line number Diff line number Diff line change @@ -425,3 +425,12 @@ def test_set_text_with_charset(self):
425
425
self .assertEqual ("текст" , resp .text )
426
426
self .assertEqual ("текст" .encode ('koi8-r' ), resp .body )
427
427
self .assertEqual ("koi8-r" , resp .charset )
428
+
429
+ def test_started_when_not_started (self ):
430
+ resp = StreamResponse ()
431
+ self .assertFalse (resp .started )
432
+
433
+ def test_started_when_started (self ):
434
+ resp = StreamResponse ()
435
+ resp .start (self .make_request ('GET' , '/' ))
436
+ self .assertTrue (resp .started )
You can’t perform that action at this time.
0 commit comments