def write(self, data): assert isinstance(data, (bytes, bytearray, memoryview)), "Data should be bytes" if data: self._write_head() run_in_loop(self._response.write, data)
def write(self, data): assert isinstance( data, (bytes, bytearray, memoryview)), "Data should be bytes" if data: self._write_head() run_in_loop(self._response.write, data)
def _write_head(self): assert self._response, "Application did not call start_response()" if not self._response.prepared: run_in_loop(self._response.prepare, self._request)
def _write_head(self): assert self._response, "Application did not call start_response()" if not self._response.started: run_in_loop(self._response.start, self._request)