use of com.microsoft.graph.http.CustomRequest in project msgraph-sdk-java-core by microsoftgraph.
the class BaseClientTests method testCustomRequest.
@Test
public void testCustomRequest() {
baseClient.setHttpProvider(new CoreHttpProvider(new DefaultSerializer(mLogger), mLogger, new OkHttpClient.Builder().build()));
final CustomRequestBuilder<JsonElement> simpleRequestBuilder = baseClient.customRequest("");
assertNotNull(simpleRequestBuilder);
final CustomRequestBuilder<String> stringRequestBuilder = baseClient.customRequest("", String.class);
assertNotNull(stringRequestBuilder);
final CustomRequest<String> abs = stringRequestBuilder.buildRequest();
abs.setHttpMethod(HttpMethod.POST);
final Request nat = abs.getHttpRequest("somestring");
assertEquals("\"somestring\"", getStringFromRequestBody(nat));
assertEquals("application", nat.body().contentType().type());
assertEquals("json", nat.body().contentType().subtype());
}
Aggregations