Skip to content

Commit 4052003

Browse files
replace Content-Type with Accept on bodyless GET proxy routes
buildForwardHeaders now defaults to Accept: application/json instead of Content-Type, since most callers are GET proxies with no body. POST/PUT routes that send a body now set Content-Type explicitly. closes #1002 Signed-off-by: Vishali <vsanghis@redhat.com>
1 parent 4c8486e commit 4052003

20 files changed

Lines changed: 20 additions & 21 deletions

File tree

components/frontend/src/app/api/auth/github/install/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function POST(request: Request) {
77

88
const resp = await fetch(`${BACKEND_URL}/auth/github/install`, {
99
method: 'POST',
10-
headers,
10+
headers: { ...headers, 'Content-Type': 'application/json' },
1111
body,
1212
})
1313

components/frontend/src/app/api/auth/github/pat/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function POST(request: Request) {
77

88
const resp = await fetch(`${BACKEND_URL}/auth/github/pat`, {
99
method: 'POST',
10-
headers,
10+
headers: { ...headers, 'Content-Type': 'application/json' },
1111
body,
1212
})
1313

components/frontend/src/app/api/auth/gitlab/connect/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function POST(request: Request) {
77

88
const resp = await fetch(`${BACKEND_URL}/auth/gitlab/connect`, {
99
method: 'POST',
10-
headers,
10+
headers: { ...headers, 'Content-Type': 'application/json' },
1111
body,
1212
})
1313

components/frontend/src/app/api/auth/jira/connect/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function POST(request: Request) {
77

88
const resp = await fetch(`${BACKEND_URL}/auth/jira/connect`, {
99
method: 'POST',
10-
headers,
10+
headers: { ...headers, 'Content-Type': 'application/json' },
1111
body,
1212
})
1313

components/frontend/src/app/api/cluster-info/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function GET() {
1010
const response = await fetch(`${BACKEND_URL}/cluster-info`, {
1111
method: 'GET',
1212
headers: {
13-
'Content-Type': 'application/json',
13+
'Accept': 'application/json',
1414
},
1515
});
1616

components/frontend/src/app/api/feature-flags/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function GET(request: NextRequest) {
2626
method: 'GET',
2727
headers: {
2828
Authorization: clientKey,
29-
'Content-Type': 'application/json',
29+
'Accept': 'application/json',
3030
},
3131
next: { revalidate: 15 },
3232
});

components/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/git/configure-remote/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function POST(
1313
`${BACKEND_URL}/projects/${encodeURIComponent(name)}/agentic-sessions/${encodeURIComponent(sessionName)}/git/configure-remote`,
1414
{
1515
method: 'POST',
16-
headers,
16+
headers: { ...headers, 'Content-Type': 'application/json' },
1717
body,
1818
}
1919
);

components/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/repos/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function POST(
1313
`${BACKEND_URL}/projects/${encodeURIComponent(name)}/agentic-sessions/${encodeURIComponent(sessionName)}/repos`,
1414
{
1515
method: 'POST',
16-
headers,
16+
headers: { ...headers, 'Content-Type': 'application/json' },
1717
body,
1818
}
1919
);

components/frontend/src/app/api/projects/[name]/agentic-sessions/[sessionName]/workflow/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function POST(
1313
`${BACKEND_URL}/projects/${encodeURIComponent(name)}/agentic-sessions/${encodeURIComponent(sessionName)}/workflow`,
1414
{
1515
method: 'POST',
16-
headers,
16+
headers: { ...headers, 'Content-Type': 'application/json' },
1717
body,
1818
}
1919
);

components/frontend/src/app/api/projects/[name]/agentic-sessions/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function POST(
3333

3434
const response = await fetch(`${BACKEND_URL}/projects/${encodeURIComponent(name)}/agentic-sessions`, {
3535
method: 'POST',
36-
headers,
36+
headers: { ...headers, 'Content-Type': 'application/json' },
3737
body,
3838
});
3939

0 commit comments

Comments
 (0)