use of org.apache.hc.core5.http.message.BasicHttpRequest in project httpcomponents-core by apache.
the class TestBasicMessages method testRequestWithAuthority.
@Test
public void testRequestWithAuthority() throws Exception {
final HttpRequest request = new BasicHttpRequest(Method.GET, new HttpHost("http", "somehost", -1), "/stuff");
Assertions.assertEquals(Method.GET.name(), request.getMethod());
Assertions.assertEquals("/stuff", request.getPath());
Assertions.assertEquals(new URIAuthority("somehost"), request.getAuthority());
Assertions.assertEquals(new URI("http://somehost/stuff"), request.getUri());
}
use of org.apache.hc.core5.http.message.BasicHttpRequest in project httpcomponents-core by apache.
the class TestBasicMessages method testRequestWithRelativeURI.
@Test
public void testRequestWithRelativeURI() throws Exception {
final HttpRequest request = new BasicHttpRequest(Method.GET, new URI("/stuff"));
Assertions.assertEquals(Method.GET.name(), request.getMethod());
Assertions.assertEquals("/stuff", request.getPath());
Assertions.assertNull(request.getAuthority());
Assertions.assertEquals(new URI("/stuff"), request.getUri());
}
use of org.apache.hc.core5.http.message.BasicHttpRequest in project httpcomponents-core by apache.
the class TestBasicMessages method testRequestWithAuthorityRelativePath.
@Test
public void testRequestWithAuthorityRelativePath() throws Exception {
final HttpRequest request = new BasicHttpRequest(Method.GET, new HttpHost("http", "somehost", -1), "stuff");
Assertions.assertEquals(Method.GET.name(), request.getMethod());
Assertions.assertEquals("stuff", request.getPath());
Assertions.assertEquals(new URIAuthority("somehost"), request.getAuthority());
Assertions.assertEquals(new URI("http://somehost/stuff"), request.getUri());
}
use of org.apache.hc.core5.http.message.BasicHttpRequest in project httpcomponents-core by apache.
the class TestBasicMessages method testRequestWithUserInfo.
@Test
public void testRequestWithUserInfo() throws Exception {
final HttpRequest request = new BasicHttpRequest(Method.GET, new URI("https://user:pwd@host:9443/stuff?param=value"));
Assertions.assertEquals(Method.GET.name(), request.getMethod());
Assertions.assertEquals("/stuff?param=value", request.getPath());
Assertions.assertEquals(new URIAuthority("user:pwd", "host", 9443), request.getAuthority());
Assertions.assertEquals("https", request.getScheme());
Assertions.assertEquals(new URI("https://host:9443/stuff?param=value"), request.getUri());
}
use of org.apache.hc.core5.http.message.BasicHttpRequest in project httpcomponents-core by apache.
the class TestBasicMessages method testRequestWithAbsoluteURIAsPath.
@Test
public void testRequestWithAbsoluteURIAsPath() throws Exception {
final HttpRequest request = new BasicHttpRequest(Method.GET, "https://host:9443/stuff?param=value");
Assertions.assertEquals(Method.GET.name(), request.getMethod());
Assertions.assertEquals("/stuff?param=value", request.getPath());
Assertions.assertEquals(new URIAuthority("host", 9443), request.getAuthority());
Assertions.assertEquals("https", request.getScheme());
Assertions.assertEquals(new URI("https://host:9443/stuff?param=value"), request.getUri());
}
Aggregations