diff --git a/trustgraph-flow/trustgraph/gateway/endpoint/manager.py b/trustgraph-flow/trustgraph/gateway/endpoint/manager.py index bb94aed1..f9616d9a 100644 --- a/trustgraph-flow/trustgraph/gateway/endpoint/manager.py +++ b/trustgraph-flow/trustgraph/gateway/endpoint/manager.py @@ -55,11 +55,13 @@ class EndpointManager: StreamEndpoint( endpoint_path = "/api/v1/import-core", auth = auth, + method = "POST", dispatcher = dispatcher_manager.dispatch_core_import(), ), StreamEndpoint( endpoint_path = "/api/v1/export-core", auth = auth, + method = "GET", dispatcher = dispatcher_manager.dispatch_core_export(), ), ] diff --git a/trustgraph-flow/trustgraph/gateway/endpoint/stream_endpoint.py b/trustgraph-flow/trustgraph/gateway/endpoint/stream_endpoint.py index 45759b0f..649c043e 100644 --- a/trustgraph-flow/trustgraph/gateway/endpoint/stream_endpoint.py +++ b/trustgraph-flow/trustgraph/gateway/endpoint/stream_endpoint.py @@ -8,12 +8,13 @@ logger.setLevel(logging.INFO) class StreamEndpoint: - def __init__(self, endpoint_path, auth, dispatcher): + def __init__(self, endpoint_path, auth, dispatcher, method="POST"): self.path = endpoint_path self.auth = auth self.operation = "service" + self.method = method self.dispatcher = dispatcher @@ -22,9 +23,16 @@ class StreamEndpoint: def add_routes(self, app): - app.add_routes([ - web.post(self.path, self.handle), - ]) + if self.method == "POST": + app.add_routes([ + web.post(self.path, self.handle), + ]) + elif self.method == "GET": + app.add_routes([ + web.get(self.path, self.handle), + ]) + else: + raise RuntimeError("Bad method" + self.method) async def handle(self, request):