Set content type for RDAP responses before setting the payload

Also sets the charset to UTF8 explicitly, to avoid confusion, and removes apparently unneeded Truth8 include.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171963981
This commit is contained in:
mountford 2017-10-12 08:42:52 -07:00 committed by jianglai
parent c0f8da0c6e
commit 9d1eb0d429
2 changed files with 12 additions and 4 deletions

View file

@ -16,7 +16,6 @@ package google.registry.rdap;
import static com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.request.Action.Method.GET;
import static google.registry.request.Action.Method.HEAD;
import static google.registry.testing.DatastoreHelper.createTld;
@ -143,6 +142,13 @@ public class RdapActionBaseTest {
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testContentType_rdapjson_utf8() throws Exception {
generateActualJson("no.thing");
assertThat(response.getContentType().toString())
.isEqualTo("application/rdap+json; charset=utf-8");
}
@Test
public void testHeadRequest_returnsNoContent() throws Exception {
assertThat(generateHeadPayload("no.thing")).isEmpty();