use of com.linkedin.restli.common.ContentType in project rest.li by linkedin.
the class TestContentType method testProtobufContentType.
@Test
public void testProtobufContentType() throws MimeTypeParseException {
ContentType contentType = ContentType.getContentType("application/x-protobuf").get();
Assert.assertEquals(contentType, ContentType.PROTOBUF);
ContentType contentTypeWithParameter = ContentType.getContentType("application/x-protobuf; charset=utf-8").get();
Assert.assertEquals(contentTypeWithParameter, ContentType.PROTOBUF);
}
use of com.linkedin.restli.common.ContentType in project rest.li by linkedin.
the class TestContentType method testPSONContentType.
@Test
public void testPSONContentType() throws MimeTypeParseException {
ContentType contentType = ContentType.getContentType("application/x-pson").get();
Assert.assertEquals(contentType, ContentType.PSON);
ContentType contentTypeWithParameter = ContentType.getContentType("application/x-pson; charset=utf-8").get();
Assert.assertEquals(contentTypeWithParameter, ContentType.PSON);
}
use of com.linkedin.restli.common.ContentType in project rest.li by linkedin.
the class TestContentType method testGetResponseProtobuf2ContentTypeOverriddenSymbolTable.
@Test
public void testGetResponseProtobuf2ContentTypeOverriddenSymbolTable() throws MimeTypeParseException {
ContentType contentType = ContentType.getResponseContentType("application/x-protobuf2; symbol-table=\"OverrideResponse\"", TEST_URI, Collections.emptyMap()).get();
Assert.assertEquals("application/x-protobuf2; symbol-table=\"OverrideResponse\"", contentType.getHeaderKey());
}
use of com.linkedin.restli.common.ContentType in project rest.li by linkedin.
the class TestContentType method testGetResponseNullContentType.
@Test
public void testGetResponseNullContentType() throws MimeTypeParseException {
ContentType contentType = ContentType.getResponseContentType(null, TEST_URI, Collections.emptyMap()).get();
Assert.assertEquals(ContentType.JSON, contentType);
}
use of com.linkedin.restli.common.ContentType in project rest.li by linkedin.
the class TestMultiplexedRequestHandlerImpl method testGetContentTypeWithParameters.
@Test(dataProvider = "multiplexerConfigurations")
public void testGetContentTypeWithParameters(MultiplexerRunMode multiplexerRunMode) throws Exception {
createMultiplexer(null, multiplexerRunMode);
RestRequest request = muxRequestBuilder().setHeader(RestConstants.HEADER_CONTENT_TYPE, "application/json; charset=utf-8").build();
ContentType contentType = ContentType.getContentType(request.getHeader(RestConstants.HEADER_CONTENT_TYPE)).get();
assertEquals(contentType, ContentType.JSON);
}
Aggregations