MCPcopy
hub / github.com/VibiumDev/vibium / test_on_request_method_headers

Function test_on_request_method_headers

tests/py/test_sync_network_events.py:17–32  ·  view source on GitHub ↗

on_request captures method and headers.

(sync_browser, test_server)

Source from the content-addressed store, hash-verified

15
16
17def test_on_request_method_headers(sync_browser, test_server):
18 """on_request captures method and headers."""
19 vibe = sync_browser.new_page()
20 vibe.go(test_server + "/fetch")
21 captured = {}
22
23 def handler(req):
24 if "api/data" in req.url():
25 captured["method"] = req.method()
26 captured["headers"] = req.headers()
27
28 vibe.on_request(handler)
29 vibe.evaluate("doFetch()")
30 vibe.wait(500)
31 assert captured.get("method") == "GET"
32 assert isinstance(captured.get("headers"), dict)
33
34
35def test_on_response(sync_browser, test_server):

Callers

nothing calls this directly

Calls 6

getMethod · 0.80
new_pageMethod · 0.45
goMethod · 0.45
on_requestMethod · 0.45
evaluateMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected