Skip to content

Commit d498614

Browse files
Copilotlpcox
andauthored
test(proxy): clean up graphql query preservation test
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/4809eb86-df75-49ee-94fe-225e87c3467d Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 6e538d9 commit d498614

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

internal/proxy/handler_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func TestServeHTTP_GraphQLIntrospectionPassthrough(t *testing.T) {
188188
assert.Contains(t, w.Body.String(), "__schema")
189189
}
190190

191-
func TestServeHTTP_GraphQLQueryStringForwardedToUpstream(t *testing.T) {
191+
func TestServeHTTP_GraphQLPreservesQueryString(t *testing.T) {
192192
var receivedURL string
193193
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
194194
receivedURL = r.URL.RequestURI()
@@ -202,9 +202,10 @@ func TestServeHTTP_GraphQLQueryStringForwardedToUpstream(t *testing.T) {
202202
s := newTestServer(t, upstream.URL)
203203
h := &proxyHandler{server: s}
204204

205-
gqlBody, _ := json.Marshal(map[string]interface{}{
205+
gqlBody, err := json.Marshal(map[string]interface{}{
206206
"query": `{ repository(owner:"org", name:"repo") { issues(first: 10) { nodes { id } } } }`,
207207
})
208+
require.NoError(t, err)
208209
req := httptest.NewRequest(http.MethodPost, "/graphql?foo=bar", bytes.NewReader(gqlBody))
209210
req.Header.Set("Content-Type", "application/json")
210211
w := httptest.NewRecorder()

0 commit comments

Comments
 (0)