mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-07 02:25:21 +03:00
fix(iou): return 405 error for unsupported suspend operation
Fixed IOU node suspend API to return proper HTTP 405 Method Not Allowed error instead of misleading 204 No Content response. Changes: - Added HTTPException import to iou_nodes.py - Fixed suspend_iou_node route from /stop to /suspend (bug fix) - Changed response from 204 No Content to 405 Method Not Allowed - Added clear error message: "Suspend is not supported for IOU nodes" This fix ensures clients receive explicit feedback when attempting to suspend IOU nodes, which do not support suspend functionality. Related issue: IOU nodes previously returned 404 when suspend was called due to incorrect route registration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
dce4a71004
commit
0056bdd19b
@ -20,7 +20,7 @@ API routes for IOU nodes.
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Union
|
||||
@ -186,8 +186,7 @@ async def stop_iou_node(node: IOUVM = Depends(dep_node)) -> None:
|
||||
|
||||
|
||||
@router.post(
|
||||
"/{node_id}/stop",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
"/{node_id}/suspend",
|
||||
dependencies=[Depends(compute_authentication)]
|
||||
)
|
||||
def suspend_iou_node(node: IOUVM = Depends(dep_node)) -> None:
|
||||
@ -196,7 +195,10 @@ def suspend_iou_node(node: IOUVM = Depends(dep_node)) -> None:
|
||||
Does nothing since IOU doesn't support being suspended.
|
||||
"""
|
||||
|
||||
pass
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_405_METHOD_NOT_ALLOWED,
|
||||
detail="Suspend is not supported for IOU nodes"
|
||||
)
|
||||
|
||||
|
||||
@router.post(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user