This tests that if a request has gzip header but the body is not compressed, then it should return an error
(t *testing.T)
| 998 | // This tests that if a request has gzip header but the body is |
| 999 | // not compressed, then it should return an error |
| 1000 | func 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 |
nothing calls this directly
no test coverage detected