Skip to content

Commit 4ecce85

Browse files
authored
feat: add accept header for api proxy for rendering, close #745 (#747)
1 parent f04fea9 commit 4ecce85

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

k8s_resource_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func TestNewResourceRegistry(t *testing.T) {
7676
g := reg.GetGroup("dashboard.grafana.app")
7777
if g == nil {
7878
t.Fatal("expected non-nil group")
79+
return
7980
}
8081
if g.Name != "dashboard.grafana.app" {
8182
t.Errorf("Name = %q, want %q", g.Name, "dashboard.grafana.app")

tools/rendering.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ func getPanelImage(ctx context.Context, args GetPanelImageParams) (*mcp.CallTool
130130
// Add user agent
131131
req.Header.Set("User-Agent", mcpgrafana.UserAgent())
132132

133+
// Prefer raw image bytes so API gateways (e.g. Kong) that inspect
134+
// Accept to decide response format return the PNG directly.
135+
req.Header.Set("Accept", "image/*")
136+
133137
// Execute request
134138
resp, err := httpClient.Do(req)
135139
if err != nil {

0 commit comments

Comments
 (0)