mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-24 15:58:08 +00:00
Return just version number for API /v1/version for compatibility
This commit is contained in:
parent
b2ce7ee8d7
commit
8114c1d4be
@ -20,5 +20,3 @@ from gns3server.handlers.index_handler import IndexHandler
|
||||
|
||||
from gns3server.handlers.api.controller import *
|
||||
from gns3server.handlers.api.hypervisor import *
|
||||
|
||||
|
||||
|
@ -17,5 +17,3 @@
|
||||
|
||||
from .server_handler import ServerHandler
|
||||
from .version_handler import VersionHandler
|
||||
|
||||
|
||||
|
@ -36,5 +36,3 @@ if sys.platform.startswith("linux") or hasattr(sys, "_called_from_test") or os.e
|
||||
if not sys.platform.startswith("win"):
|
||||
from .iou_handler import IOUHandler
|
||||
from .docker_handler import DockerHandler
|
||||
|
||||
|
||||
|
@ -14,9 +14,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from ..web.route import Route
|
||||
from ..modules.port_manager import PortManager
|
||||
from ..modules.project_manager import ProjectManager
|
||||
from ..version import __version__
|
||||
|
||||
|
||||
class IndexHandler:
|
||||
@ -24,8 +26,7 @@ class IndexHandler:
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/",
|
||||
description="Home page for GNS3Server",
|
||||
api_version=None
|
||||
description="Home page for GNS3Server"
|
||||
)
|
||||
def index(request, response):
|
||||
response.template("index.html")
|
||||
@ -33,11 +34,18 @@ class IndexHandler:
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/status",
|
||||
description="Ressources used by GNS3Server",
|
||||
api_version=None
|
||||
description="Ressources used by GNS3Server"
|
||||
)
|
||||
def ports(request, response):
|
||||
response.template("status.html",
|
||||
port_manager=PortManager.instance(),
|
||||
project_manager=ProjectManager.instance()
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/v1/version",
|
||||
description="Old API"
|
||||
)
|
||||
def get_v1(request, response):
|
||||
response.json({"version": __version__})
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -34,3 +34,11 @@ def test_index(http_root):
|
||||
def test_status(http_root):
|
||||
response = http_root.get('/status')
|
||||
assert response.status == 200
|
||||
|
||||
|
||||
def test_v1(http_root):
|
||||
"""
|
||||
The old api v1 raise a 429
|
||||
"""
|
||||
response = http_root.get('/v1/version')
|
||||
assert response.status == 200
|
||||
|
Loading…
Reference in New Issue
Block a user