MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / gzipCompressionHeader

Function gzipCompressionHeader

graphql/e2e/common/common.go:1000–1022  ·  view source on GitHub ↗

This tests that if a request has gzip header but the body is not compressed, then it should return an error

(t *testing.T)

Source from the content-addressed store, hash-verified

998// This tests that if a request has gzip header but the body is
999// not compressed, then it should return an error
1000func gzipCompressionHeader(t *testing.T) {
1001 queryCountry := &GraphQLParams{
1002 Query: `query {
1003 queryCountry {
1004 name
1005 }
1006 }`,
1007 }
1008
1009 req, err := queryCountry.CreateGQLPost(GraphqlURL)
1010 require.NoError(t, err)
1011
1012 req.Header.Set("Content-Encoding", "gzip")
1013
1014 resData, err := RunGQLRequest(req)
1015 require.NoError(t, err)
1016
1017 var result *GraphQLResponse
1018 err = json.Unmarshal(resData, &result)
1019 require.NoError(t, err)
1020 require.NotNil(t, result.Errors)
1021 require.Contains(t, result.Errors[0].Message, "Unable to parse gzip")
1022}
1023
1024// This tests that if a req's body is compressed but the
1025// header is not present, then it should return an error

Callers

nothing calls this directly

Calls 3

CreateGQLPostMethod · 0.95
RunGQLRequestFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected