Esempio n. 1
0
 def callback(request, name):
     if request.url.host == "foo.bar" and request.content == b'{"foo": "bar"}':
         return respx.MockResponse(
             202,
             headers={"X-Foo": "bar"},
             text=f"hello {name}",
             http_version="HTTP/2",
         )
     return httpx.Response(404)
Esempio n. 2
0
 def content_callback(request, slug):
     content = jsonlib.loads(request.content)
     return respx.MockResponse(text=f"hello {slug}{content['x']}")