Skip to content

Replace incorrect Content-Type header with Accept header on bodyless GET proxy fetch calls #1002

@coderabbitai

Description

@coderabbitai

Problem

Several Next.js API proxy routes in components/frontend/src/app/api/ send Content-Type: application/json on outbound fetch() calls that use GET with no request body. Content-Type describes the format of a request body; it is semantically incorrect (and misleading) on a bodyless GET. The correct header to signal that the caller expects a JSON response is Accept: application/json.

This was surfaced during review of PR #998 (comment: #998 (comment)). The fix was intentionally deferred from that PR to keep all proxy routes consistent in a single follow-up.

Notably, components/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/agui/events/route.ts already explicitly deletes Content-Type for its GET SSE request, confirming awareness of the issue.

Affected routes (outbound GET fetch with wrong header)

  • components/frontend/src/app/api/version/route.ts
  • components/frontend/src/app/api/cluster-info/route.ts
  • components/frontend/src/app/api/projects/[name]/settings/route.ts (GET handler)
  • components/frontend/src/app/api/workflows/ootb/route.ts (GET handler)
  • components/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/mcp/status/route.ts

(And any other GET handlers that set Content-Type without a body — a full audit of the components/frontend/src/app/api/ directory is recommended.)

Proposed fix

For each bodyless outbound GET fetch, replace:

headers: {
  'Content-Type': 'application/json',
}

with:

headers: {
  'Accept': 'application/json',
}

Requests that include a body (POST/PUT/PATCH) correctly keep Content-Type: application/json and are out of scope.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions