mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
FIX PUT CORS for nodes, Fixes: #1434
This commit is contained in:
parent
df36d8377d
commit
fa5571ced1
@ -55,6 +55,20 @@ class NodeHandler:
|
|||||||
response.set_status(201)
|
response.set_status(201)
|
||||||
response.json(node)
|
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(
|
@Route.get(
|
||||||
r"/projects/{project_id}/nodes/{node_id}",
|
r"/projects/{project_id}/nodes/{node_id}",
|
||||||
status_codes={
|
status_codes={
|
||||||
@ -70,19 +84,6 @@ class NodeHandler:
|
|||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
response.json(node)
|
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(
|
@Route.put(
|
||||||
r"/projects/{project_id}/nodes/{node_id}",
|
r"/projects/{project_id}/nodes/{node_id}",
|
||||||
|
@ -277,6 +277,7 @@ class WebServer:
|
|||||||
for method, route, handler in Route.get_routes():
|
for method, route, handler in Route.get_routes():
|
||||||
log.debug("Adding route: {} {}".format(method, route))
|
log.debug("Adding route: {} {}".format(method, route))
|
||||||
cors.add(self._app.router.add_route(method, route, handler))
|
cors.add(self._app.router.add_route(method, route, handler))
|
||||||
|
|
||||||
for module in MODULES:
|
for module in MODULES:
|
||||||
log.debug("Loading module {}".format(module.__name__))
|
log.debug("Loading module {}".format(module.__name__))
|
||||||
m = module.instance()
|
m = module.instance()
|
||||||
|
Loading…
Reference in New Issue
Block a user