How to use the blacksheep.server.responses.text function in blacksheep

To help you get started, we’ve selected a few blacksheep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RobertoPrevato / BlackSheep / tests / test_controllers.py View on Github external
async def index(self, request: Request):
            return text(self.greet())
github RobertoPrevato / BlackSheep / tests / test_controllers.py View on Github external
async def index(self, request: Request, user: Optional[User]):
            assert hasattr(request, 'identity')
            assert isinstance(request.identity, User)
            return text(request.identity.name)
github RobertoPrevato / BlackSheep / itests / app.py View on Github external
async def echo_chunked_text(request):
    text_from_client = await request.text()
    return text(text_from_client)
github RobertoPrevato / BlackSheep / itests / app.py View on Github external
async def set_cookies(name: FromQuery(str), value: FromQuery(str)):
    response = text('Setting cookie')
    response.set_cookie(Cookie(name.encode(), value.encode()))
    return response
github RobertoPrevato / BlackSheep / blacksheep / server / controllers.py View on Github external
def text(self, value: str, status: int = 200) -> Response:
        """Returns a response with text/plain content, and given status (default HTTP 200 OK)."""
        return text(value, status)