(self)
| 768 | """ |
| 769 | |
| 770 | def get_app(self): |
| 771 | class HelloHandler(RequestHandler): |
| 772 | def get(self): |
| 773 | self.finish("Hello world") |
| 774 | |
| 775 | def post(self): |
| 776 | self.finish("Hello world") |
| 777 | |
| 778 | class LargeHandler(RequestHandler): |
| 779 | def get(self): |
| 780 | # 512KB should be bigger than the socket buffers so it will |
| 781 | # be written out in chunks. |
| 782 | self.write("".join(chr(i % 256) * 1024 for i in range(512))) |
| 783 | |
| 784 | class TransferEncodingChunkedHandler(RequestHandler): |
| 785 | @gen.coroutine |
| 786 | def head(self): |
| 787 | self.write("Hello world") |
| 788 | yield self.flush() |
| 789 | |
| 790 | class FinishOnCloseHandler(RequestHandler): |
| 791 | def initialize(self, cleanup_event): |
| 792 | self.cleanup_event = cleanup_event |
| 793 | |
| 794 | @gen.coroutine |
| 795 | def get(self): |
| 796 | self.flush() |
| 797 | yield self.cleanup_event.wait() |
| 798 | |
| 799 | def on_connection_close(self): |
| 800 | # This is not very realistic, but finishing the request |
| 801 | # from the close callback has the right timing to mimic |
| 802 | # some errors seen in the wild. |
| 803 | self.finish("closed") |
| 804 | |
| 805 | self.cleanup_event = Event() |
| 806 | return Application( |
| 807 | [ |
| 808 | ("/", HelloHandler), |
| 809 | ("/large", LargeHandler), |
| 810 | ("/chunked", TransferEncodingChunkedHandler), |
| 811 | ( |
| 812 | "/finish_on_close", |
| 813 | FinishOnCloseHandler, |
| 814 | dict(cleanup_event=self.cleanup_event), |
| 815 | ), |
| 816 | ] |
| 817 | ) |
| 818 | |
| 819 | def setUp(self): |
| 820 | super().setUp() |
nothing calls this directly
no test coverage detected