Skip to content

fix(api): use query param instead of body for GET /backend/monitor#9273

Open
Bahtya wants to merge 1 commit intomudler:masterfrom
Bahtya:fix/backend-monitor-get-query-param
Open

fix(api): use query param instead of body for GET /backend/monitor#9273
Bahtya wants to merge 1 commit intomudler:masterfrom
Bahtya:fix/backend-monitor-get-query-param

Conversation

@Bahtya
Copy link
Copy Markdown

@Bahtya Bahtya commented Apr 8, 2026

Problem

The /backend/monitor endpoint uses HTTP GET but its Swagger annotation declares a request body (@Param request body schema.BackendMonitorRequest). This violates REST conventions and breaks:

  • OpenAPI code generators
  • Swagger UI (confusing UX)
  • Standard HTTP clients that strip body from GET requests

Root Cause

The Swagger annotation in backend_monitor.go uses @Param request body for a GET endpoint. Per OpenAPI spec, GET requests should not have request bodies.

Solution

Changed the Swagger annotation from body param to query param:

// Before:
// @Param request body schema.BackendMonitorRequest true "Backend statistics request"

// After:
// @Param model query string true "Model name"

Echo's c.Bind() already handles query parameters for GET requests, so no code changes are needed — only the annotation fix.

Testing

  • The endpoint already works with query params via Echo's Bind() — this just fixes the documentation/codegen.

Fixes #9207

The /backend/monitor endpoint uses HTTP GET but its Swagger annotation
declares a request body, which violates REST conventions and breaks
OpenAPI code generators and Swagger UI.

Echo's c.Bind() already handles query parameters for GET requests,
so only the Swagger annotation needs to be fixed.

Fixes mudler#9207

Signed-off-by: bahtya <bahtyar153@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/backend/monitor GET endpoint incorrectly requires body parameter (Swagger/docs and implementation do not match REST standards)

1 participant