Adds a function to the internal list of functions that should be called as part of closing down the response. Since 0.7 this function also returns the function that was passed so that this can be used as a decorator. .. versionadded:: 0.6
(self, func: t.Callable[[], t.Any])
| 177 | self.response = response |
| 178 | |
| 179 | def call_on_close(self, func: t.Callable[[], t.Any]) -> t.Callable[[], t.Any]: |
| 180 | """Adds a function to the internal list of functions that should |
| 181 | be called as part of closing down the response. Since 0.7 this |
| 182 | function also returns the function that was passed so that this |
| 183 | can be used as a decorator. |
| 184 | |
| 185 | .. versionadded:: 0.6 |
| 186 | """ |
| 187 | self._on_close.append(func) |
| 188 | return func |
| 189 | |
| 190 | def __repr__(self) -> str: |
| 191 | if self.is_sequence: |