Java Code Examples for com.linecorp.armeria.common.ResponseHeaders#get()

The following examples show how to use com.linecorp.armeria.common.ResponseHeaders#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryServiceV1Test.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
@Test
void createRepository() throws IOException {
    final WebClient client = dogma.httpClient();
    final AggregatedHttpResponse aRes = createRepository(client, "myRepo");
    final ResponseHeaders headers = ResponseHeaders.of(aRes.headers());
    assertThat(headers.status()).isEqualTo(HttpStatus.CREATED);

    final String location = headers.get(HttpHeaderNames.LOCATION);
    assertThat(location).isEqualTo("/api/v1/projects/myPro/repos/myRepo");

    final JsonNode jsonNode = Jackson.readTree(aRes.contentUtf8());
    assertThat(jsonNode.get("name").asText()).isEqualTo("myRepo");
    assertThat(jsonNode.get("headRevision").asInt()).isOne();
    assertThat(jsonNode.get("createdAt").asText()).isNotNull();
}
 
Example 2
Source File: ProjectServiceV1Test.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
@Test
void createProject() throws IOException {
    final WebClient client = dogma.httpClient();
    final AggregatedHttpResponse aRes = createProject(client, "myPro");
    final ResponseHeaders headers = ResponseHeaders.of(aRes.headers());
    assertThat(headers.status()).isEqualTo(HttpStatus.CREATED);

    final String location = headers.get(HttpHeaderNames.LOCATION);
    assertThat(location).isEqualTo("/api/v1/projects/myPro");

    final JsonNode jsonNode = Jackson.readTree(aRes.contentUtf8());
    assertThat(jsonNode.get("name").asText()).isEqualTo("myPro");
    assertThat(jsonNode.get("createdAt").asText()).isNotNull();
}