Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 429 Bytes

text.md

File metadata and controls

13 lines (10 loc) · 429 Bytes

Generic producer

Assign any string value to self.text to write it directly to the response.

@router.get('/some_page', cls=PageHandler)
async def get_page(handler=get_current_handler()):
    handler.text = 'OK'
    handler.set_header('Content-Type', media_types.TEXT_PLAIN)

This producer is used by default if self.text value is not None. Note that you should also set neccessary Content-Type headers.