1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Merge pull request #1435 from GNS3/fix-put-cors-for-nodes

FIX PUT CORS for nodes, Fixes: #1434
This commit is contained in:
ziajka 2018-10-23 12:41:14 +02:00 committed by GitHub
commit 4158edf8e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -55,6 +55,20 @@ class NodeHandler:
response.set_status(201)
response.json(node)
@Route.get(
r"/projects/{project_id}/nodes",
parameters={
"project_id": "Project UUID"
},
status_codes={
200: "List of nodes returned",
},
description="List nodes of a project")
async def list_nodes(request, response):
project = await Controller.instance().get_loaded_project(request.match_info["project_id"])
response.json([v for v in project.nodes.values()])
@Route.get(
r"/projects/{project_id}/nodes/{node_id}",
status_codes={
@ -70,19 +84,6 @@ class NodeHandler:
response.set_status(200)
response.json(node)
@Route.get(
r"/projects/{project_id}/nodes",
parameters={
"project_id": "Project UUID"
},
status_codes={
200: "List of nodes returned",
},
description="List nodes of a project")
async def list_nodes(request, response):
project = await Controller.instance().get_loaded_project(request.match_info["project_id"])
response.json([v for v in project.nodes.values()])
@Route.put(
r"/projects/{project_id}/nodes/{node_id}",

View File

@ -277,6 +277,7 @@ class WebServer:
for method, route, handler in Route.get_routes():
log.debug("Adding route: {} {}".format(method, route))
cors.add(self._app.router.add_route(method, route, handler))
for module in MODULES:
log.debug("Loading module {}".format(module.__name__))
m = module.instance()