(t *testing.T)
| 1335 | } |
| 1336 | |
| 1337 | func TestResponseEncoding(t *testing.T) { |
| 1338 | // Make a doc longer than 1k so the HTTP response will be compressed: |
| 1339 | str := "DORKY " |
| 1340 | for i := 0; i < 10; i++ { |
| 1341 | str = str + str |
| 1342 | } |
| 1343 | docJSON := fmt.Sprintf(`{"long": %q}`, str) |
| 1344 | |
| 1345 | rt := NewRestTester(t, nil) |
| 1346 | defer rt.Close() |
| 1347 | |
| 1348 | response := rt.SendAdminRequest("PUT", "/{{.keyspace}}/_local/loc1", docJSON) |
| 1349 | RequireStatus(t, response, 201) |
| 1350 | response = rt.SendAdminRequestWithHeaders("GET", "/{{.keyspace}}/_local/loc1", "", |
| 1351 | map[string]string{"Accept-Encoding": "foo, gzip, bar"}) |
| 1352 | RequireStatus(t, response, 200) |
| 1353 | assert.Equal(t, "gzip", response.Header().Get("Content-Encoding")) |
| 1354 | unzip, err := gzip.NewReader(response.Body) |
| 1355 | assert.NoError(t, err) |
| 1356 | unjson := base.JSONDecoder(unzip) |
| 1357 | var body db.Body |
| 1358 | assert.Equal(t, nil, unjson.Decode(&body)) |
| 1359 | assert.Equal(t, str, body["long"]) |
| 1360 | } |
| 1361 | |
| 1362 | func TestAllDocsChannelsAfterChannelMove(t *testing.T) { |
| 1363 |
nothing calls this directly
no test coverage detected