예제 #1
0
def convert_responses(response: HttpxResponse) -> StarletteResponse:
    """
    Converts a HttpxResponse to a StarletteResponse
    """
    return StarletteResponse(
        content=response.content,
        status_code=response.status_code,
        headers=response.headers,  # type: ignore[arg-type]
    )
예제 #2
0
    async def __call__(self, receive, send):
        body, headers = await self.body
        if self.headers:
            headers.update(self.headers)

        response = StarletteResponse(body,
                                     status_code=self.status_code,
                                     headers=headers)
        await response(receive, send)
예제 #3
0
파일: starlette.py 프로젝트: revensky/psion
 async def create_response(self, response: Response) -> StarletteResponse:
     return StarletteResponse(response.body, response.status_code,
                              response.headers)