Ejemplo n.º 1
0
 def handle(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(
         response=response,
         status=201,
         headers={"foo": "bar"},
         content_type="text/plain",
         body="Yo, page!",
     )
Ejemplo n.º 2
0
 def handle(route: Route) -> None:
     page.request.fetch(route.request)
     route.fulfill(status=201)
Ejemplo n.º 3
0
 def handle(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(response=response,
                   status=201,
                   body="",
                   headers={"content-length": "0"})
Ejemplo n.º 4
0
 def handle_route(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(response=response)
 def handler(route: Route):
     try:
         route.fulfill(response=47)
     except Exception:
         route.fallback()
Ejemplo n.º 6
0
 def handler(route: Route, request: Request):
     route.fulfill(status=200, body=payload)
Ejemplo n.º 7
0
 def handle(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(response=response, status=201, body="")
Ejemplo n.º 8
0
 def handle_request(route: Route) -> None:
     request = playwright.request.new_context()
     response = request.get(server.PREFIX + "/simple.json")
     route.fulfill(response=response)
     request.dispose()