1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 09:18:08 +00:00

FIX PUT CORS for nodes, Fixes: #1434

This commit is contained in:
ziajka 2018-10-23 11:09:38 +02:00
parent df36d8377d
commit fa5571ced1
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()