refactor: use shared ServiceLink blueprint
- Replace the local /rpc Quart route with the shared ServiceLink blueprint helper. - Move mesh scope enforcement into bearer_verifier via require_scope. - Update ServiceLink tests to call the public handle_envelope and verify exports. - Advance the servicelink submodule to include the shared CLI and RPC discovery work.
This commit is contained in:
@@ -9,7 +9,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from quart import Quart
|
||||
|
||||
from servicelink import Request
|
||||
from servicelink import Request, handle_envelope
|
||||
|
||||
# Load routes/api/link.py in isolation. Importing it as `routes.api.link` would
|
||||
# run routes/__init__.py -> my_modules.app.setup -> constens (asyncio.run at
|
||||
@@ -63,11 +63,11 @@ def _call(envelope, token=None):
|
||||
app = Quart(__name__)
|
||||
app.convex = FakeConvex()
|
||||
async with app.test_request_context('/rpc', method='POST'):
|
||||
status, body, _ = await link.handle_envelope(
|
||||
status, body, _ = await handle_envelope(
|
||||
link.router,
|
||||
json.dumps(envelope).encode('utf-8'),
|
||||
authorization=f'Bearer {token}' if token else None,
|
||||
verify=link._verify,
|
||||
verify=link.verify,
|
||||
content_type='application/json',
|
||||
)
|
||||
return status, json.loads(body)
|
||||
|
||||
Reference in New Issue
Block a user