Skip to content

Commit

Permalink
Accept event-stream for POST for urql-graphql (#3276)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Coffman <[email protected]>
  • Loading branch information
StevenACoffman authored Sep 14, 2024
1 parent 4157ef9 commit ae51624
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions graphql/handler/transport/http_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ func (h POST) Supports(r *http.Request) bool {
return false
}

if strings.Contains(r.Header.Get("Accept"), "text/event-stream") {
return false
}

mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
return false
Expand Down
4 changes: 2 additions & 2 deletions graphql/handler/transport/http_post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func TestPOST(t *testing.T) {
}

resp := doReq(h, "POST", "/graphql", `{"query":"{ name }"}`)
assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String())
assert.Equal(t, `{"errors":[{"message":"transport not supported"}],"data":null}`, resp.Body.String())
assert.Equal(t, http.StatusOK, resp.Code, resp.Body.String())
assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String())
})
}

Expand Down

0 comments on commit ae51624

Please sign in to comment.