Describe the bug
The /backend/monitor API endpoint currently returns an error or confusion because Swagger (OpenAPI spec) and documentation indicate that a request body is required, but the HTTP method is GET — which, by REST and OpenAPI standards, must NOT have a body. This makes the endpoint:
- Not work with standard HTTP clients and code generation tools
- Breaks Swagger UI and OpenAPI codegen
- Causes documentation and UX confusion
- Technically invalid per REST standards
File: core/http/endpoints/localai/backend_monitor.go
To Reproduce
- Visit Swagger UI or try to call
/backend/monitor as GET with a body (not supported by many clients)
- See docs: backend-monitor.md shows
curl -d with GET, also invalid
Expected behavior
- The model to monitor should be passed as a query parameter, not a body, e.g.:
/backend/monitor?model=name
- Swagger/OpenAPI spec should mark
model as a query param, not a body param
- Documentation and example cURL should reflect correct REST usage
Suggestions for the fix
- Update Swagger annotation in [
backend_monitor.go]
- Change from:
// @Param request body schema.BackendMonitorRequest true "Backend statistics request"
to:
// @Param model query string true "Model name to monitor"
- Update handler implementation:
- Instead of
c.Bind(input), use input.Model = c.QueryParam("model") for clarity.
- Update docs:
- Change documentation and curl example to:
curl "http://localhost:8080/backend/monitor?model=my-model"
- (Optional): Consider failing with a clear error if model param is missing, and update OpenAPI/swag as well as tests.
Additional context
- This will improve REST standards conformance, client interop, and user experience.
- Note: The POST
/backend/shutdown is fine as it properly uses a body per REST conventions.
Describe the bug
The
/backend/monitorAPI endpoint currently returns an error or confusion because Swagger (OpenAPI spec) and documentation indicate that a request body is required, but the HTTP method isGET— which, by REST and OpenAPI standards, must NOT have a body. This makes the endpoint:File:
core/http/endpoints/localai/backend_monitor.goTo Reproduce
/backend/monitoras GET with a body (not supported by many clients)curl -dwith GET, also invalidExpected behavior
/backend/monitor?model=namemodelas aqueryparam, not a body paramSuggestions for the fix
backend_monitor.go]// @Param request body schema.BackendMonitorRequest true "Backend statistics request"// @Param model query string true "Model name to monitor"c.Bind(input), useinput.Model = c.QueryParam("model")for clarity.curl "http://localhost:8080/backend/monitor?model=my-model"Additional context
/backend/shutdownis fine as it properly uses a body per REST conventions.