コード例 #1
0
 def test_body_response(self) -> None:
     e = HttpRequestRejected(
         status_code=httpStatusCodes.NOT_FOUND, reason=b'NOT FOUND',
         body=b'Nothing here')
     self.assertEqual(
         e.response(self.request),
         build_http_response(httpStatusCodes.NOT_FOUND, reason=b'NOT FOUND', body=b'Nothing here'))
コード例 #2
0
 def test_status_code_response(self) -> None:
     e = HttpRequestRejected(status_code=200, reason=b'OK')
     self.assertEqual(
         e.response(self.request),
         CRLF.join([
             b'HTTP/1.1 200 OK',
             b'Connection: close',
             CRLF,
         ]),
     )
コード例 #3
0
 def test_empty_response(self) -> None:
     e = HttpRequestRejected()
     self.assertEqual(e.response(self.request), None)