Skip to content

Commit 4235e47

Browse files
Copilotlpcox
andauthored
Fix golangci-lint failures: remove unused forwardGraphQL, fix S1034 type switch
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/7feddbce-4f91-48ec-9a03-dba7585fca09
1 parent 61cca86 commit 4235e47

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

internal/proxy/handler.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -291,24 +291,6 @@ func (h *proxyHandler) passthrough(w http.ResponseWriter, r *http.Request, path
291291
h.writeResponse(w, resp, respBody)
292292
}
293293

294-
// forwardGraphQL forwards a GraphQL request without DIFC filtering.
295-
func (h *proxyHandler) forwardGraphQL(w http.ResponseWriter, r *http.Request, _ string, body []byte) {
296-
resp, err := h.server.forwardToGitHub(r.Context(), http.MethodPost, "/graphql", bytes.NewReader(body), "application/json")
297-
if err != nil {
298-
http.Error(w, "upstream request failed", http.StatusBadGateway)
299-
return
300-
}
301-
defer resp.Body.Close()
302-
303-
respBody, err := io.ReadAll(resp.Body)
304-
if err != nil {
305-
http.Error(w, "failed to read upstream response", http.StatusBadGateway)
306-
return
307-
}
308-
309-
h.writeResponse(w, resp, respBody)
310-
}
311-
312294
// writeResponse writes an upstream response to the client.
313295
func (h *proxyHandler) writeResponse(w http.ResponseWriter, resp *http.Response, body []byte) {
314296
copyResponseHeaders(w, resp)
@@ -326,11 +308,10 @@ func (h *proxyHandler) writeEmptyResponse(w http.ResponseWriter, resp *http.Resp
326308
w.WriteHeader(resp.StatusCode)
327309

328310
var empty string
329-
switch originalData.(type) {
311+
switch obj := originalData.(type) {
330312
case []interface{}:
331313
empty = "[]"
332314
case map[string]interface{}:
333-
obj := originalData.(map[string]interface{})
334315
// GraphQL responses wrap their payload in a "data" key
335316
if _, ok := obj["data"]; ok {
336317
empty = `{"data":null}`

0 commit comments

Comments
 (0)