示例#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!",
     )
示例#2
0
 def handle(route: Route) -> None:
     page.request.fetch(route.request)
     route.fulfill(status=201)
示例#3
0
 def handle(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(response=response,
                   status=201,
                   body="",
                   headers={"content-length": "0"})
示例#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()
示例#6
0
 def handler(route: Route, request: Request):
     route.fulfill(status=200, body=payload)
示例#7
0
 def handle(route: Route) -> None:
     response = page.request.fetch(route.request)
     route.fulfill(response=response, status=201, body="")
 def handle_request(route: Route) -> None:
     request = playwright.request.new_context()
     response = request.get(server.PREFIX + "/simple.json")
     route.fulfill(response=response)
     request.dispose()