mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-18 06:18: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:
commit
4158edf8e2
@ -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}",
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user