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 11CHANGES
22=======
33
4+ 0.13.1 (Unreleased)
5+ --------------------
6+
7+ - Add `aiohttp.web.StreamResponse.started` property #213
8+
9+
4100.13.0 (12-29-2014)
511-------------------
612
Original file line number Diff line number Diff line change @@ -409,6 +409,10 @@ def _copy_cookies(self):
409409 value = cookie .output (header = '' )[1 :]
410410 self .headers .add ('Set-Cookie' , value )
411411
412+ @property
413+ def started (self ):
414+ return self ._resp_impl is not None
415+
412416 @property
413417 def status (self ):
414418 return self ._status
Original file line number Diff line number Diff line change @@ -474,6 +474,11 @@ StreamResponse
474474 parameter. Otherwise pass :class: `str ` with
475475 arbitrary *status * explanation..
476476
477+ .. attribute :: started
478+
479+ Read-only :class: `bool ` property, ``True `` if :meth: `start ` has
480+ been called, ``False `` otherwise.
481+
477482 .. attribute :: status
478483
479484 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):
425425 self .assertEqual ("текст" , resp .text )
426426 self .assertEqual ("текст" .encode ('koi8-r' ), resp .body )
427427 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